comparison 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
comparison
equal deleted inserted replaced
33851:7827fbbd0b06 33852:f18b11534274
173 return getattr(thing, attr, _notset) is not _notset 173 return getattr(thing, attr, _notset) is not _notset
174 174
175 def bytesinput(fin, fout, *args, **kwargs): 175 def bytesinput(fin, fout, *args, **kwargs):
176 sin, sout = sys.stdin, sys.stdout 176 sin, sout = sys.stdin, sys.stdout
177 try: 177 try:
178 sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout)
178 if pycompat.ispy3: 179 if pycompat.ispy3:
179 sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout)
180 return encoding.strtolocal(input(*args, **kwargs)) 180 return encoding.strtolocal(input(*args, **kwargs))
181 else: 181 else:
182 sys.stdin, sys.stdout = fin, fout
183 return raw_input(*args, **kwargs) 182 return raw_input(*args, **kwargs)
184 finally: 183 finally:
185 sys.stdin, sys.stdout = sin, sout 184 sys.stdin, sys.stdout = sin, sout
186 185
187 def bitsfrom(container): 186 def bitsfrom(container):