mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Merge universal newlines-related fixes (issue #13119)
This commit is contained in:
		
						commit
						6f1a40ffd3
					
				
					 2 changed files with 30 additions and 27 deletions
				
			
		|  | @ -563,21 +563,22 @@ def test_writes_before_communicate(self): | |||
|     def test_universal_newlines(self): | ||||
|         p = subprocess.Popen([sys.executable, "-c", | ||||
|                               'import sys,os;' + SETBINARY + | ||||
|                               'sys.stdout.write(sys.stdin.readline());' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line2\\n");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write(sys.stdin.read());' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line4\\n");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line5\\r\\n");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line6\\r");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("\\nline7");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("\\nline8");'], | ||||
|                               'buf = sys.stdout.buffer;' | ||||
|                               'buf.write(sys.stdin.readline().encode());' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line2\\n");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(sys.stdin.read().encode());' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line4\\n");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line5\\r\\n");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line6\\r");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"\\nline7");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"\\nline8");'], | ||||
|                              stdin=subprocess.PIPE, | ||||
|                              stdout=subprocess.PIPE, | ||||
|                              universal_newlines=1) | ||||
|  | @ -597,17 +598,18 @@ def test_universal_newlines_communicate(self): | |||
|         # universal newlines through communicate() | ||||
|         p = subprocess.Popen([sys.executable, "-c", | ||||
|                               'import sys,os;' + SETBINARY + | ||||
|                               'sys.stdout.write("line2\\n");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line4\\n");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line5\\r\\n");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("line6\\r");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("\\nline7");' | ||||
|                               'sys.stdout.flush();' | ||||
|                               'sys.stdout.write("\\nline8");'], | ||||
|                               'buf = sys.stdout.buffer;' | ||||
|                               'buf.write(b"line2\\n");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line4\\n");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line5\\r\\n");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"line6\\r");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"\\nline7");' | ||||
|                               'buf.flush();' | ||||
|                               'buf.write(b"\\nline8");'], | ||||
|                              stderr=subprocess.PIPE, | ||||
|                              stdout=subprocess.PIPE, | ||||
|                              universal_newlines=1) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Antoine Pitrou
						Antoine Pitrou