Issue #16903: Popen.communicate() on Unix now accepts strings when

universal_newlines is true as on Windows.
This commit is contained in:
Serhiy Storchaka 2013-02-04 16:47:39 +02:00
parent 0b4591e0eb
commit b3f194d109
4 changed files with 40 additions and 5 deletions

View file

@ -1519,6 +1519,8 @@ class Popen(object):
fd2output[self.stderr.fileno()] = stderr = []
input_offset = 0
if self.universal_newlines and isinstance(input, str):
input = input.encode(self.stdin.encoding)
while fd2file:
try:
ready = poller.poll()
@ -1571,6 +1573,8 @@ class Popen(object):
stderr = []
input_offset = 0
if self.universal_newlines and isinstance(input, str):
input = input.encode(self.stdin.encoding)
while read_set or write_set:
try:
rlist, wlist, xlist = select.select(read_set, write_set, [])