comparison mercurial/util.py @ 30472:277f4fe6d01a

py3: provide bytes stdin/out/err through util module Since standard streams are TextIO on Python 3, we can't use sys.stdin/out/err directly. Fortunately we can get the underlying BytesIO via .buffer as long as the streams aren't replaced by e.g. StringIO. stdin/out/err are provided through util so we can wrap them by platform API.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 20 Oct 2016 23:40:24 +0900
parents 00c9ac4ce816
children 39d13b8c101d
comparison
equal deleted inserted replaced
30471:00c9ac4ce816 30472:277f4fe6d01a
52 httplib = pycompat.httplib 52 httplib = pycompat.httplib
53 httpserver = pycompat.httpserver 53 httpserver = pycompat.httpserver
54 pickle = pycompat.pickle 54 pickle = pycompat.pickle
55 queue = pycompat.queue 55 queue = pycompat.queue
56 socketserver = pycompat.socketserver 56 socketserver = pycompat.socketserver
57 stderr = pycompat.stderr
58 stdin = pycompat.stdin
59 stdout = pycompat.stdout
57 stringio = pycompat.stringio 60 stringio = pycompat.stringio
58 urlerr = pycompat.urlerr 61 urlerr = pycompat.urlerr
59 urlparse = pycompat.urlparse 62 urlparse = pycompat.urlparse
60 urlreq = pycompat.urlreq 63 urlreq = pycompat.urlreq
61 xmlrpclib = pycompat.xmlrpclib 64 xmlrpclib = pycompat.xmlrpclib
62 65
63 if os.name == 'nt': 66 if os.name == 'nt':
64 from . import windows as platform 67 from . import windows as platform
68 stdout = platform.winstdout(pycompat.stdout)
65 else: 69 else:
66 from . import posix as platform 70 from . import posix as platform
67 71
68 _ = i18n._ 72 _ = i18n._
69 73