This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: remove unnecesary .flush() calls in the asyncio subprocess code example
Type: Stage:
Components: Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: akira, docs@python, giampaolo.rodola, gvanrossum, pitrou, python-dev, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2014-05-12 17:59 by akira, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
docs-subprocess-remove-unnecessary-flush-from-code-example.patch akira, 2014-05-12 17:59 remove unnecessary flush() calls review
Messages (3)
msg218342 - (view) Author: Akira Li (akira) * Date: 2014-05-12 17:59
The current code example contains [1]:

    print("Python failed with exit code %s:" % exitcode)
    sys.stdout.flush()
    sys.stdout.buffer.flush()
    sys.stdout.buffer.write(stdout)
    sys.stdout.buffer.flush()

that looks bizarre.

Either a comment should be added that explains why the `.flush()` calls
are necessary or they should be removed.

I've attached the documentation patch that removes the calls.

[1] http://hg.python.org/cpython/file/2af5a52b9b87/Doc/library/asyncio-subprocess.rst#l227
msg218366 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-05-12 21:25
New changeset c0404f0da01a by Victor Stinner in branch '3.4':
Issue #21485: remove unnecesary .flush() calls in the asyncio subprocess code
http://hg.python.org/cpython/rev/c0404f0da01a

New changeset 3c26389d741c by Victor Stinner in branch 'default':
(Merge 3.4) Issue #21485: remove unnecesary .flush() calls in the asyncio
http://hg.python.org/cpython/rev/3c26389d741c
msg218367 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-05-12 21:26
I wrote the example and the first call to buffer.flush() is a mistake. Thanks for your patch, I applied it.
History
Date User Action Args
2022-04-11 14:58:03adminsetgithub: 65684
2014-05-12 21:26:08vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg218367
2014-05-12 21:25:35python-devsetnosy: + python-dev
messages: + msg218366
2014-05-12 19:09:40berker.peksagsetnosy: + gvanrossum, pitrou, vstinner, giampaolo.rodola, yselivanov
2014-05-12 17:59:23akiracreate