Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 78406:09408b990ca5 3.2
Close #13119: use "\r\n" newline for sys.stdout/err on Windows
sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Sat, 04 Aug 2012 01:37:32 +0200 |
| parents | c97d78415f5a |
| children | b256d054f229 92c6bbf7bb85 |
comparison
equal
deleted
inserted
replaced
| 78403:243ad1a6f638 | 78406:09408b990ca5 |
|---|---|
| 868 line_buffering = Py_False; | 868 line_buffering = Py_False; |
| 869 | 869 |
| 870 Py_CLEAR(raw); | 870 Py_CLEAR(raw); |
| 871 Py_CLEAR(text); | 871 Py_CLEAR(text); |
| 872 | 872 |
| 873 #ifdef MS_WINDOWS | |
| 874 /* sys.stdin: enable universal newline mode, translate "\r\n" and "\r" | |
| 875 newlines to "\n". | |
| 876 sys.stdout and sys.stderr: translate "\n" to "\r\n". */ | |
| 877 newline = NULL; | |
| 878 #else | |
| 879 /* sys.stdin: split lines at "\n". | |
| 880 sys.stdout and sys.stderr: don't translate newlines (use "\n"). */ | |
| 873 newline = "\n"; | 881 newline = "\n"; |
| 874 #ifdef MS_WINDOWS | |
| 875 if (!write_mode) { | |
| 876 /* translate \r\n to \n for sys.stdin on Windows */ | |
| 877 newline = NULL; | |
| 878 } | |
| 879 #endif | 882 #endif |
| 880 | 883 |
| 881 stream = PyObject_CallMethod(io, "TextIOWrapper", "OsssO", | 884 stream = PyObject_CallMethod(io, "TextIOWrapper", "OsssO", |
| 882 buf, encoding, errors, | 885 buf, encoding, errors, |
| 883 newline, line_buffering); | 886 newline, line_buffering); |
