◐ Shell
clean mode source ↗

Message 125534 - Python tracker

Ok, actually it boils down to the following code in Modules/main.c:

    if (Py_UnbufferedStdioFlag) {
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
        _setmode(fileno(stdin), O_BINARY);
        _setmode(fileno(stdout), O_BINARY);
#endif

... which explains things quite clearly! Archeology leads to r7409 by Guido in 1997:

changeset:   4916:5af9f8a98d93
branch:      trunk
user:        guido
date:        Sat Jan 11 20:28:55 1997 +0100
files:       Modules/main.c
description:
[svn r7409] On Windows, -u implies binary mode for stdin/stdout
(as well as unbuffered stdout/stderr).