Nick Coghlan added the comment:

Changing the target version and summarising my understanding of the status quo:

"python3": sys.stderr is line buffered at both the TextIOWrapper layer and may 
be fully buffered at the binary BufferedWriter layer if the output is 
redirected to a file
"python3 -u": the BufferedWriter layer is omitted entirely, leaving only the 
line buffering at the TextIOWrapper layer

Looking at http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html 
(which also covers stdout and stderr), it specifically says about stderr: "When 
opened, the standard error stream is not fully buffered;".

That means either line buffering or no buffering is considered acceptable, but 
full buffering is not.

So, at the very least, it seems to me that the way we configure stderr should 
be the same regardless of whether or not "-u" is used: omit the BufferedWriter 
layer.

Given that POSIX allows compliant implementations to use line-buffering on 
stderr, the "missing trailing newline and no implicit flush() is ever 
triggered" scenario is probably obscure enough not to worry about.

----------
versions: +Python 3.6 -Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13601>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to