[Python-ideas] Replacing the standard IO streams (was Re: changing sys.stdout encoding)
ncoghlan at gmail.com
Mon Jun 11 08:12:45 CEST 2012
On Mon, Jun 11, 2012 at 2:43 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> On 10.06.12 18:44, Nick Coghlan wrote:
>> This approach also has the advantage of leaving
>> sys.__std(in/out/err)__ in a somewhat usable state.
> And then sys.std* and sys.__std*__ have their own inconsistent buffers.
Correct, but using detach() leaves sys.__std*__ completely broken
(either throwing exceptions or silently failing to emit output).
Creating two independent streams that share the underlying file handle
is much closer to the 2.x behaviour when replacing sys.std*.
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas