Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Oh, this is a serious problem.

AFAIK TextIOWrapper initially supported only buffered writers, but the support 
of non-buffered writers was added later. We can make TextIOWrapper calling 
write() of underlying binary stream repeatedly, but it will break the code 
which uses TextIOWrapper with other file-like objects whose write() method does 
not return the number of written bytes. For example:

    buffer = []
    class Writer: write = buffer.append
    t = TextIOWrapper(Writer())

Even if we fix writing sys.stdout and sys.stderr there will be a problem with 
programs which write directly to sys.stdout.buffer or use open(buffering=0).

This is a complex issue and it needs a complex solution.

----------

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

Reply via email to