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 @@ -673,6 +673,20 @@ # to stderr at exit of subprocess. self.assertTrue(stderr.startswith("eline2\neline6\neline7\neline8\n")) + def test_universal_newlines_communicate_stdin_lf(self): + # universal newlines through communicate(), with only stdin + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + '''\nif True: + s = sys.stdin.readline() + assert s == "line1\\n", repr(s) + s = sys.stdin.read() + assert s == "line3\\n", repr(s) + '''], + stdin=subprocess.PIPE, + universal_newlines=1) + (stdout, stderr) = p.communicate("line1\r\nline3\r") + self.assertEqual(p.returncode, 0) + def test_no_leaking(self): # Make sure we leak no resources if not mswindows: