summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 93d093d..0b656e5 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -527,11 +527,14 @@ Py_Main(int argc, wchar_t **argv)
stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0);
- if (Py_UnbufferedStdioFlag) {
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
- _setmode(fileno(stdin), O_BINARY);
- _setmode(fileno(stdout), O_BINARY);
+ /* don't translate newlines (\r\n <=> \n) */
+ _setmode(fileno(stdin), O_BINARY);
+ _setmode(fileno(stdout), O_BINARY);
+ _setmode(fileno(stderr), O_BINARY);
#endif
+
+ if (Py_UnbufferedStdioFlag) {
#ifdef HAVE_SETVBUF
setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ);
setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);