[issue16587] Py_Initialize breaks wprintf on Windows

STINNER Victor report at bugs.python.org
Mon Dec 3 12:49:58 CET 2012


STINNER Victor added the comment:

> _setmode(self->fd, O_BINARY) change was done in Python 3.2: see the issue #10841

The main reason was to be able to read binary file from sys.stdin
using the CGI module: see the issue #4953. In _O_TEXT mode, 0x0A byte
is replaced with 0x0A 0x0D (or the opposite, I never remember) which
corrupt binary files.

Articles about _setmode() and wprintf():

"A confluence of circumstances leaves a stone unturned..."
http://blogs.msdn.com/b/michkap/archive/2010/09/23/10066660.aspx

"Conventional wisdom is retarded, aka What the @#%&* is _O_U16TEXT?"
http://blogs.msdn.com/b/michkap/archive/2008/03/18/8306597.aspx

See also issue #1602 (Windows console doesn't print or input Unicode).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16587>
_______________________________________


More information about the Python-bugs-list mailing list