Issue #21332: Ensure that `bufsize=1` in subprocess.Popen() selects line buffering, rather than block buffering.

This commit is contained in:
Antoine Pitrou 2014-09-21 21:15:42 +02:00
commit 6e311aa748
4 changed files with 50 additions and 7 deletions

View file

@ -841,7 +841,8 @@ class Popen(object):
if p2cwrite != -1:
self.stdin = io.open(p2cwrite, 'wb', bufsize)
if universal_newlines:
self.stdin = io.TextIOWrapper(self.stdin, write_through=True)
self.stdin = io.TextIOWrapper(self.stdin, write_through=True,
line_buffering=(bufsize == 1))
if c2pread != -1:
self.stdout = io.open(c2pread, 'rb', bufsize)
if universal_newlines: