Mercurial > hg-stable
changeset 30629:a82a6eee2613
py3: have a bytes version of sys.platform
sys.platform returns unicodes on Python 3. This patch adds up
pycompat.sysplatform which returns bytes.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 18 Dec 2016 00:52:05 +0530 |
parents | c6026c20a3ce |
children | bcf4a975f93d |
files | mercurial/pycompat.py |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pycompat.py Sun Dec 18 00:44:21 2016 +0530 +++ b/mercurial/pycompat.py Sun Dec 18 00:52:05 2016 +0530 @@ -50,6 +50,7 @@ # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which # returns bytes. getcwd = os.getcwdb + sysplatform = sys.platform.encode('ascii') # TODO: .buffer might not exist if std streams were replaced; we'll need # a silly wrapper to make a bytes stream backed by a unicode one. @@ -153,6 +154,7 @@ stdout = sys.stdout stderr = sys.stderr sysargv = sys.argv + sysplatform = sys.platform getcwd = os.getcwd stringio = io.StringIO