Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pycompat.py @ 31368:73b3bee8febe
pycompat: default to BytesIO instead of StringIO
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 13 Mar 2017 00:55:14 +0530 |
parents | 295625f1296b |
children | 06440ba06bc0 |
comparison
equal
deleted
inserted
replaced
31367:4015dfc899bb | 31368:73b3bee8febe |
---|---|
53 getcwd = os.getcwdb | 53 getcwd = os.getcwdb |
54 sysplatform = sys.platform.encode('ascii') | 54 sysplatform = sys.platform.encode('ascii') |
55 sysexecutable = sys.executable | 55 sysexecutable = sys.executable |
56 if sysexecutable: | 56 if sysexecutable: |
57 sysexecutable = os.fsencode(sysexecutable) | 57 sysexecutable = os.fsencode(sysexecutable) |
58 stringio = io.BytesIO | |
58 | 59 |
59 # TODO: .buffer might not exist if std streams were replaced; we'll need | 60 # TODO: .buffer might not exist if std streams were replaced; we'll need |
60 # a silly wrapper to make a bytes stream backed by a unicode one. | 61 # a silly wrapper to make a bytes stream backed by a unicode one. |
61 stdin = sys.stdin.buffer | 62 stdin = sys.stdin.buffer |
62 stdout = sys.stdout.buffer | 63 stdout = sys.stdout.buffer |
178 sysargv = sys.argv | 179 sysargv = sys.argv |
179 sysplatform = sys.platform | 180 sysplatform = sys.platform |
180 getcwd = os.getcwd | 181 getcwd = os.getcwd |
181 sysexecutable = sys.executable | 182 sysexecutable = sys.executable |
182 shlexsplit = shlex.split | 183 shlexsplit = shlex.split |
183 | 184 stringio = io.StringIO |
184 stringio = io.StringIO | 185 |
185 empty = _queue.Empty | 186 empty = _queue.Empty |
186 queue = _queue.Queue | 187 queue = _queue.Queue |
187 | 188 |
188 class _pycompatstub(object): | 189 class _pycompatstub(object): |
189 def __init__(self): | 190 def __init__(self): |