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 serhiy.storchaka
Recipients methane, mjacob, pitrou, serhiy.storchaka, vstinner
Date 2020-07-08.08:29:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594196957.59.0.393321990532.issue41221@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-07-08 08:29:17serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner, methane, mjacob
2020-07-08 08:29:17serhiy.storchakasetmessageid: <1594196957.59.0.393321990532.issue41221@roundup.psfhosted.org>
2020-07-08 08:29:17serhiy.storchakalinkissue41221 messages
2020-07-08 08:29:17serhiy.storchakacreate