[Python-ideas] Replacing the standard IO streams (was Re: changing sys.stdout encoding)

Serhiy Storchaka storchaka at gmail.com
Sun Jun 10 16:45:02 CEST 2012


On 10.06.12 05:26, Nick Coghlan wrote:
> Calling detach() on the standard streams is a bad idea - the interpreter
> uses the originals internally, and calling detach() breaks them.

If interpreter uses standard streams then it uses raw C streams (FILE *) 
stdin/stdout/etc. Calling open(sys.stdin.fileno()) bypasses internal 
buffering in sys.stdin, sys.stdin.buffer, sys.stdin.decoder and raw C 
stdin (if it used in lower level), and lose and break multibyte characters.




More information about the Python-ideas mailing list