classification
Title: smtplib's __main__ doesn't flush when prompting
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: anacrolix, ezio.melotti, petri.lehtinen, python-dev, r.david.murray, rhettinger
Priority: normal Keywords: patch

Created on 2011-06-30 06:20 by anacrolix, last changed 2011-10-18 10:29 by ezio.melotti. This issue is now closed.

Files
File name Uploaded Description Edit
smtplib_main_prompt.patch petri.lehtinen, 2011-07-03 20:05
Messages (6)
msg139461 - (view) Author: Matt Joiner (anacrolix) Date: 2011-06-30 06:20
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.
msg139699 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-07-03 20:05
Behaves incorrectly for me, too. Attached a patch with the suggested fix.
msg141063 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-07-24 23:24
Looks good.
Thx.
msg145787 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-10-18 08:54
Raymond: Would you also like to commit the patch? :)
msg145793 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-18 10:27
New changeset 2c50343d0500 by Ezio Melotti in branch '3.2':
#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':
#12448: merge with 3.2.
http://hg.python.org/cpython/rev/e08397a5537a
msg145794 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-10-18 10:29
Fixed, thanks for the patch!
History
Date User Action Args
2011-10-18 10:29:29ezio.melottisetstatus: open -> closed

assignee: rhettinger -> ezio.melotti
versions: + Python 3.3
nosy: + ezio.melotti

messages: + msg145794
resolution: fixed
stage: patch review -> resolved
2011-10-18 10:27:02python-devsetnosy: + python-dev
messages: + msg145793
2011-10-18 08:54:36petri.lehtinensetkeywords: - needs review

messages: + msg145787
2011-07-24 23:24:32rhettingersetassignee: rhettinger

messages: + msg141063
nosy: + rhettinger
2011-07-24 19:44:25petri.lehtinensetstage: patch review
2011-07-03 20:05:25petri.lehtinensetfiles: + smtplib_main_prompt.patch

nosy: + petri.lehtinen
messages: + msg139699

keywords: + patch, needs review
2011-06-30 14:10:35r.david.murraysetnosy: + r.david.murray
2011-06-30 06:20:26anacrolixcreate