Unbuffered stderr in Python 3

Chris Angelico rosuav at gmail.com
Tue Nov 3 10:42:19 EST 2015


On Wed, Nov 4, 2015 at 2:00 AM, Random832 <random832 at fastmail.com> wrote:
> Nobody <nobody at nowhere.invalid> writes:
>
>> It's probably related to the fact that std{in,out,err} are Unicode
>> streams.
>
> There's no fundamental reason a Unicode stream should have to be line
> buffered. If it's "related", it's only in that an oversight was made in
> the course of making that change.

Yep. Unicode *input* streams need to be buffered, but *output* can
always be insta-flushed. The only significance of Unicode to output is
that a single character may cause multiple bytes to be output; and
since output can block for even a single byte, it should be no
different.

+1 for making sys.stderr unbuffered.

ChrisA



More information about the Python-list mailing list