Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smtplib's __main__ doesn't flush when prompting #56657

Closed
anacrolix mannequin opened this issue Jun 30, 2011 · 6 comments
Closed

smtplib's __main__ doesn't flush when prompting #56657

anacrolix mannequin opened this issue Jun 30, 2011 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@anacrolix
Copy link
Mannequin

anacrolix mannequin commented Jun 30, 2011

BPO 12448
Nosy @rhettinger, @ezio-melotti, @bitdancer, @anacrolix, @akheron
Files
  • smtplib_main_prompt.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ezio-melotti'
    closed_at = <Date 2011-10-18.10:29:29.651>
    created_at = <Date 2011-06-30.06:20:26.410>
    labels = ['type-bug', 'library']
    title = "smtplib's __main__ doesn't flush when prompting"
    updated_at = <Date 2011-10-18.10:29:29.628>
    user = 'https://github.com/anacrolix'

    bugs.python.org fields:

    activity = <Date 2011-10-18.10:29:29.628>
    actor = 'ezio.melotti'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2011-10-18.10:29:29.651>
    closer = 'ezio.melotti'
    components = ['Library (Lib)']
    creation = <Date 2011-06-30.06:20:26.410>
    creator = 'anacrolix'
    dependencies = []
    files = ['22555']
    hgrepos = []
    issue_num = 12448
    keywords = ['patch']
    message_count = 6.0
    messages = ['139461', '139699', '141063', '145787', '145793', '145794']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'ezio.melotti', 'r.david.murray', 'anacrolix', 'python-dev', 'petri.lehtinen']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue12448'
    versions = ['Python 3.2', 'Python 3.3']

    @anacrolix
    Copy link
    Mannequin Author

    anacrolix mannequin commented Jun 30, 2011

    The smptlib module's __main__ doesn't flush stdout when prompting:

            sys.stdout.write(prompt + ": ")
            return sys.stdin.readline().strip()

    stdout is usually line buffered, and so running python3 smptlib.py doesn't actually prompt the user.

    The line sys.stdout.flush() needs to be added.

    @anacrolix anacrolix mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jun 30, 2011
    @akheron
    Copy link
    Member

    akheron commented Jul 3, 2011

    Behaves incorrectly for me, too. Attached a patch with the suggested fix.

    @rhettinger
    Copy link
    Contributor

    Looks good.
    Thx.

    @rhettinger rhettinger self-assigned this Jul 24, 2011
    @akheron
    Copy link
    Member

    akheron commented Oct 18, 2011

    Raymond: Would you also like to commit the patch? :)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 18, 2011

    New changeset 2c50343d0500 by Ezio Melotti in branch '3.2':
    bpo-12448: smtplib now flushes stdout while running python -m smtplib
    http://hg.python.org/cpython/rev/2c50343d0500

    New changeset e08397a5537a by Ezio Melotti in branch 'default':
    bpo-12448: merge with 3.2.
    http://hg.python.org/cpython/rev/e08397a5537a

    @ezio-melotti
    Copy link
    Member

    Fixed, thanks for the patch!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants