##// END OF EJS Templates
py3: select input or raw_input by pycompat...
Yuya Nishihara -
r33853:cfcfbe6c default
parent child Browse files
Show More
@@ -63,6 +63,7 b' if ispy3:'
63 sysexecutable = os.fsencode(sysexecutable)
63 sysexecutable = os.fsencode(sysexecutable)
64 stringio = io.BytesIO
64 stringio = io.BytesIO
65 maplist = lambda *args: list(map(*args))
65 maplist = lambda *args: list(map(*args))
66 rawinput = input
66
67
67 # TODO: .buffer might not exist if std streams were replaced; we'll need
68 # TODO: .buffer might not exist if std streams were replaced; we'll need
68 # a silly wrapper to make a bytes stream backed by a unicode one.
69 # a silly wrapper to make a bytes stream backed by a unicode one.
@@ -312,6 +313,7 b' else:'
312 shlexsplit = shlex.split
313 shlexsplit = shlex.split
313 stringio = cStringIO.StringIO
314 stringio = cStringIO.StringIO
314 maplist = map
315 maplist = map
316 rawinput = raw_input
315
317
316 class _pycompatstub(object):
318 class _pycompatstub(object):
317 def __init__(self):
319 def __init__(self):
@@ -176,10 +176,7 b' def bytesinput(fin, fout, *args, **kwarg'
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
General Comments 0
You need to be logged in to leave comments. Login now