diff -r 00c9ac4ce816 -r 277f4fe6d01a mercurial/pycompat.py --- a/mercurial/pycompat.py Fri Oct 21 00:09:38 2016 +0900 +++ b/mercurial/pycompat.py Thu Oct 20 23:40:24 2016 +0900 @@ -44,6 +44,12 @@ ospathsep = os.pathsep.encode('ascii') ossep = os.sep.encode('ascii') + # TODO: .buffer might not exist if std streams were replaced; we'll need + # a silly wrapper to make a bytes stream backed by a unicode one. + stdin = sys.stdin.buffer + stdout = sys.stdout.buffer + stderr = sys.stderr.buffer + # Since Python 3 converts argv to wchar_t type by Py_DecodeLocale() on Unix, # we can use os.fsencode() to get back bytes argv. # @@ -100,6 +106,9 @@ osname = os.name ospathsep = os.pathsep ossep = os.sep + stdin = sys.stdin + stdout = sys.stdout + stderr = sys.stderr sysargv = sys.argv stringio = io.StringIO