Issue #15595: Fix subprocess.Popen(universal_newlines=True)

for certain locales (utf-16 and utf-32 family).

Patch by Chris Jerdonek.
This commit is contained in:
Andrew Svetlov 2012-08-19 22:20:03 +03:00
commit a19de803e4
3 changed files with 37 additions and 2 deletions

View file

@ -828,8 +828,8 @@ class Popen(object):
def _translate_newlines(self, data, encoding):
data = data.replace(b"\r\n", b"\n").replace(b"\r", b"\n")
return data.decode(encoding)
data = data.decode(encoding)
return data.replace("\r\n", "\n").replace("\r", "\n")
def __enter__(self):
return self