Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 36791:30742c216abb
ui: inline util.bytesinput() into ui._readline()
Prepares for rework of Python 3 support, which is currently broken due to
read-ahead buffer of TextIOWrapper.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 06 Mar 2018 02:14:11 -0600 |
parents | e3732c3ab92d |
children | fa53a1d1f16e |
comparison
equal
deleted
inserted
replaced
36790:cb0afaf112e8 | 36791:30742c216abb |
---|---|
1276 pass | 1276 pass |
1277 | 1277 |
1278 # prompt ' ' must exist; otherwise readline may delete entire line | 1278 # prompt ' ' must exist; otherwise readline may delete entire line |
1279 # - http://bugs.python.org/issue12833 | 1279 # - http://bugs.python.org/issue12833 |
1280 with self.timeblockedsection('stdio'): | 1280 with self.timeblockedsection('stdio'): |
1281 line = util.bytesinput(self.fin, self.fout, r' ') | 1281 sin, sout = sys.stdin, sys.stdout |
1282 try: | |
1283 sys.stdin = encoding.strio(self.fin) | |
1284 sys.stdout = encoding.strio(self.fout) | |
1285 line = encoding.strtolocal(pycompat.rawinput(r' ')) | |
1286 finally: | |
1287 sys.stdin, sys.stdout = sin, sout | |
1282 | 1288 |
1283 # When stdin is in binary mode on Windows, it can cause | 1289 # When stdin is in binary mode on Windows, it can cause |
1284 # raw_input() to emit an extra trailing carriage return | 1290 # raw_input() to emit an extra trailing carriage return |
1285 if pycompat.oslinesep == '\r\n' and line and line[-1] == '\r': | 1291 if pycompat.oslinesep == '\r\n' and line and line[-1] == '\r': |
1286 line = line[:-1] | 1292 line = line[:-1] |