Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 78405:c55dbb84f3b4
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:28:00 +0200 |
| parents | 2f1494d243ad |
| children | 92c6bbf7bb85 |
comparison
equal
deleted
inserted
replaced
| 78404:083776adcacc | 78405:c55dbb84f3b4 |
|---|---|
| 969 line_buffering = Py_False; | 969 line_buffering = Py_False; |
| 970 | 970 |
| 971 Py_CLEAR(raw); | 971 Py_CLEAR(raw); |
| 972 Py_CLEAR(text); | 972 Py_CLEAR(text); |
| 973 | 973 |
| 974 #ifdef MS_WINDOWS | |
| 975 /* sys.stdin: enable universal newline mode, translate "\r\n" and "\r" | |
| 976 newlines to "\n". | |
| 977 sys.stdout and sys.stderr: translate "\n" to "\r\n". */ | |
| 978 newline = NULL; | |
| 979 #else | |
| 980 /* sys.stdin: split lines at "\n". | |
| 981 sys.stdout and sys.stderr: don't translate newlines (use "\n"). */ | |
| 974 newline = "\n"; | 982 newline = "\n"; |
| 975 #ifdef MS_WINDOWS | |
| 976 if (!write_mode) { | |
| 977 /* translate \r\n to \n for sys.stdin on Windows */ | |
| 978 newline = NULL; | |
| 979 } | |
| 980 #endif | 983 #endif |
| 981 | 984 |
| 982 stream = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "OsssO", | 985 stream = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "OsssO", |
| 983 buf, encoding, errors, | 986 buf, encoding, errors, |
| 984 newline, line_buffering); | 987 newline, line_buffering); |
