diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-04 14:47:39 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-04 14:47:39 (GMT) |
commit | b3f194d10951d5c23af885c6d55c45dfb0db0666 (patch) | |
tree | aa40c095d34ff160840f755604fb389f88487940 /Lib/subprocess.py | |
parent | 0b4591e0eb80b78b4c6a4aa6a4071c74c253bde7 (diff) | |
download | cpython-b3f194d10951d5c23af885c6d55c45dfb0db0666.zip cpython-b3f194d10951d5c23af885c6d55c45dfb0db0666.tar.gz cpython-b3f194d10951d5c23af885c6d55c45dfb0db0666.tar.bz2 |
Issue #16903: Popen.communicate() on Unix now accepts strings when
universal_newlines is true as on Windows.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index f32f081e..1a21455 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -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, []) |