comparison mercurial/util.py @ 33874:cfcfbe6c96f8

py3: select input or raw_input by pycompat This seems slightly cleaner.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 16 Aug 2017 13:54:24 +0900
parents f18b11534274
children 2ad028635ccd
comparison
equal deleted inserted replaced
33873:f18b11534274 33874:cfcfbe6c96f8
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 sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout)
179 if pycompat.ispy3: 179 return encoding.strtolocal(pycompat.rawinput(*args, **kwargs))
180 return encoding.strtolocal(input(*args, **kwargs))
181 else:
182 return raw_input(*args, **kwargs)
183 finally: 180 finally:
184 sys.stdin, sys.stdout = sin, sout 181 sys.stdin, sys.stdout = sin, sout
185 182
186 def bitsfrom(container): 183 def bitsfrom(container):
187 bits = 0 184 bits = 0