This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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.
History
Date User Action Args
2012-08-01 07:20:01vstinnersetrecipients: + vstinner, georg.brandl, ishimoto, amaury.forgeotdarc, pitrou, flox, M..Z.
2012-08-01 07:20:01vstinnersetmessageid: <1343805601.65.0.841636429476.issue13119@psf.upfronthosting.co.za>
2012-08-01 07:20:01vstinnerlinkissue13119 messages
2012-08-01 07:19:59vstinnercreate