Index: Lib/subprocess.py =================================================================== --- Lib/subprocess.py (revision 85719) +++ Lib/subprocess.py (working copy) @@ -677,8 +677,6 @@ if errread != -1: errread = msvcrt.open_osfhandle(errread.Detach(), 0) - if bufsize == 0: - bufsize = 1 # Nearly unbuffered (XXX for now) if p2cwrite != -1: self.stdin = io.open(p2cwrite, 'wb', bufsize) if self.universal_newlines: Index: Lib/test/test_subprocess.py =================================================================== --- Lib/test/test_subprocess.py (revision 85719) +++ Lib/test/test_subprocess.py (working copy) @@ -523,6 +523,15 @@ self.assertEqual(p.wait(), 0) + def test_bufsize_is_zero(self): + # bufsize=0 makes Popen unbuffered + p = subprocess.Popen([sys.executable, "-c", + 'import sys; sys.exit(sys.stdin.read(1) == "X")'], + stdin=subprocess.PIPE, bufsize=0) + p.stdin.write(b"X") + p.wait() + self.assertEqual(p.returncode, 1) + def test_invalid_bufsize(self): # an invalid type of the bufsize argument should raise # TypeError.