Author v+python
Recipients v+python
Date 2011-01-06.02:11:53
SpamBayes Score 4.94049e-14
Marked as misclassified No
Message-id <1294279917.2.0.685442041198.issue10841@psf.upfronthosting.co.za>
In-reply-to
Content
Per Antoine's request, I wrote this test code, it isn't elegant, I whipped it together quickly; but it shows the issue.  The issue may be one of my ignorance, but it does show the behavior I described in issue 4953. Here's the output from the various test parameters that might be useful in running the test.

>c:\python32\python.exe test.py test 1
['c:\\python32\\python.exe', 'test.py', '1']
All OK

>c:\python32\python.exe test.py test 2
['c:\\python32\\python.exe', 'test.py', '2']
Not OK: b'abc\r\r\ndef\r\r\n'

>c:\python32\python.exe test.py test 3
['c:\\python32\\python.exe', 'test.py', '3']
All OK

>c:\python32\python.exe test.py test 4
['c:\\python32\\python.exe', 'test.py', '4']
Not OK: b'abc\r\r\ndef\r\r\n'

>c:\python32\python.exe test.py test 1-u
['c:\\python32\\python.exe', '-u', 'test.py', '1-u']
All OK

>c:\python32\python.exe test.py test 2-u
['c:\\python32\\python.exe', '-u', 'test.py', '2-u']
All OK

>c:\python32\python.exe test.py test 3-u
['c:\\python32\\python.exe', '-u', 'test.py', '3-u']
All OK

>c:\python32\python.exe test.py test 4-u
['c:\\python32\\python.exe', '-u', 'test.py', '4-u']
All OK

>

Note that test 2 and 4, which do not use the mscvrt stuff, have double \r: one sent by the code, and another added, apparently by MSC newline processing.  test 2-u and 4-u, which are invoking the subprocess with Python's -u parameter, also do not exhibit the problem, even though the mscvrt stuff is not used.  This seems to indicate that Python's -u parameter does approximately the same thing as my windows_binary function.

Seems like if Python already has code for this, that it would be nice to either make it more easily available to the user as an API (like my windows_binary function, invoked with a single line) in the io or sys modules (since it is used to affect sys.std* files).

And it would be nice if the function "worked cross-platform", even if it is a noop on most platforms.
History
Date User Action Args
2011-01-06 02:11:57v+pythonsetrecipients: + v+python
2011-01-06 02:11:57v+pythonsetmessageid: <1294279917.2.0.685442041198.issue10841@psf.upfronthosting.co.za>
2011-01-06 02:11:53v+pythonlinkissue10841 messages
2011-01-06 02:11:53v+pythoncreate