diff mercurial/util.py @ 33852:f18b11534274

py3: make encoding.strio() an identity function on Python 2 It's the convention the other encoding.str*() functions follow. To make things simple, this also drops kwargs from the strio() constructor.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 16 Aug 2017 13:50:11 +0900
parents 7d5bc0e5b88f
children cfcfbe6c96f8
line wrap: on
line diff
--- a/mercurial/util.py	Sun Aug 13 14:12:28 2017 +0900
+++ b/mercurial/util.py	Wed Aug 16 13:50:11 2017 +0900
@@ -175,11 +175,10 @@
 def bytesinput(fin, fout, *args, **kwargs):
     sin, sout = sys.stdin, sys.stdout
     try:
+        sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout)
         if pycompat.ispy3:
-            sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout)
             return encoding.strtolocal(input(*args, **kwargs))
         else:
-            sys.stdin, sys.stdout = fin, fout
             return raw_input(*args, **kwargs)
     finally:
         sys.stdin, sys.stdout = sin, sout