Re: [Python-Dev] cpython (3.2): open() / TextIOWrapper doc: make it explicit than newline='\n' doesn't

2012-08-16 Thread Serhiy Storchaka

On 04.08.12 02:27, victor.stinner wrote:

http://hg.python.org/cpython/rev/243ad1a6f638
changeset:   78403:243ad1a6f638
branch:  3.2
parent:  78400:f19bea7bbee7
user:Victor Stinner 
date:Sat Aug 04 01:18:56 2012 +0200
summary:
   open() / TextIOWrapper doc: make it explicit than newline='\n' doesn't
translate newlines on output.



+"  newline is '' or '\n', no translation takes place. If newline is any\n"


Non-escaped "\n".

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython: Add yet another test for subprocess.Popen.communicate

2012-08-16 Thread Andrew Svetlov
Fixed in 150fa296f5b9.
New version uses binary stream for output.
assertStderrEqual cannot be applied because it strips newlines which
are subject for check.

On Thu, Aug 16, 2012 at 1:25 AM, Antoine Pitrou  wrote:
> On Wed, 15 Aug 2012 21:54:06 +0200 (CEST)
> andrew.svetlov  wrote:
>>
>> diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
>> --- a/Lib/test/test_subprocess.py
>> +++ b/Lib/test/test_subprocess.py
>> @@ -645,6 +645,34 @@
>>  p.communicate()
>>  self.assertEqual(p.returncode, 0)
>>
>> +def test_universal_newlines_communicate_stdin_stdout_stderr(self):
>> +# universal newlines through communicate(), with only stdin
>> +p = subprocess.Popen([sys.executable, "-c",
>> +  'import sys,os;' + SETBINARY + '''\nif True:
>> +  s = sys.stdin.readline()
>> +  sys.stdout.write(s)
>> +  sys.stdout.write("line2\\r")
>> +  sys.stderr.write("eline2\\n")
>> +  s = sys.stdin.read()
>> +  sys.stdout.write(s+"line4\\n")
>> +  sys.stdout.write(s+"line5\\r\\n")
>> +  sys.stderr.write("eline6\\n")
>> +  sys.stderr.write("eline7\\r")
>> +  sys.stderr.write("eline8\\r\\n")
>> +  '''],
>
> This test is wrong. You need to write your test data as binary data on
> the binary output streams, as in the other tests. Using the text
> output streams introduces a spurious line ending conversion, which makes
> the test fail under Windows:
> http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/486
>
>> +# Python debug build push something like "[42442 refs]\n"
>> +# to stderr at exit of subprocess.
>> +
>> self.assertTrue(stderr.startswith("eline2\neline6\neline7\neline8\n"))
>
> You should use self.assertStderrEqual() instead.
>
> Regards
>
> Antoine.
>
>
> --
> Software development and contracting: http://pro.pitrou.net
>
>
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com



-- 
Thanks,
Andrew Svetlov
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com