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.

Author pitrou
Recipients noam, pitrou, vstinner
Date 2010-03-23.15:33:49
SpamBayes Score 3.544295e-05
Marked as misclassified No
Message-id <1269358431.68.0.938924989029.issue8213@psf.upfronthosting.co.za>
In-reply-to
Content
In the current state of affaires this is more of a documentation issue.

Python 3 doesn't support totally unbuffered text I/O (and standard streams are open in text mode). What `-u` and PYTHONUNBUFFERED do is that the binary layer of standard streams is unbuffered, but the text layer is still line-buffered (if in a tty).

"python --help" gives you an accurate description:

-u     : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
         see man page for details on internal buffering relating to '-u'

Also, you can try out:

python3 -u -c  'import time, sys; sys.stdout.buffer.write(b"b"); time.sleep(1); sys.stdout.buffer.write(b"\n")'

To explicitly flush the text layer, you can use the flush() method.
History
Date User Action Args
2010-03-23 15:33:54pitrousetrecipients: + pitrou, vstinner, noam
2010-03-23 15:33:51pitrousetmessageid: <1269358431.68.0.938924989029.issue8213@psf.upfronthosting.co.za>
2010-03-23 15:33:50pitroulinkissue8213 messages
2010-03-23 15:33:49pitroucreate