消息 [167092]
> 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. |
|
| 日期 |
用户 |
动作 |
参数 |
| 2012-08-01 07:20:01 | vstinner | 修改 | recipients:
+ vstinner, georg.brandl, ishimoto, amaury.forgeotdarc, pitrou, flox, M..Z. |
| 2012-08-01 07:20:01 | vstinner | 修改 | messageid: <1343805601.65.0.841636429476.issue13119@psf.upfronthosting.co.za> |
| 2012-08-01 07:20:01 | vstinner | 链接 | issue13119 messages |
| 2012-08-01 07:19:59 | vstinner | 创建 | |
|