Message167092
| Author |
vstinner |
| Recipients |
M..Z., amaury.forgeotdarc, flox, georg.brandl, ishimoto, pitrou, vstinner |
| Date |
2012年08月01日.07:19:59 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1343805601.65.0.841636429476.issue13119@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> On Windows, stdin, stdout and stderr are creates using TextIOWrapper(..., newline=None).
> In this case, TextIOWrapper._writenl is os.linesep and so '\r\n'.
Oh, I was wrong: stdin is created with newline=None, but stdout and stderr are created with newline="\n" and so "\n" is not translated to "\r\n".
I checked in Python 2.7: print("abc") and sys.stdout.write("abc\n") writes b"abc\r\n" into the output file (when the output is redirected), but sys.stdout.write("abc\r\n") writes b"abc\r\r\n". Python 3.3 should do the same: \r\n is preferred on Windows (ex: notepad doesn't support UNIX line ending, \n).
Attached patch changes line ending for stdout and stderr on Windows: translate "\n" to "\r\n".
It would be nice to fix this before Python 3.3 final. |
|