# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-12-17 19:22:05 # Node ID a82a6eee261376bf562a51f1a3bb0476d297973e # Parent c6026c20a3ce8b7612033f1a45315750dc91a863 py3: have a bytes version of sys.platform sys.platform returns unicodes on Python 3. This patch adds up pycompat.sysplatform which returns bytes. diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -50,6 +50,7 @@ if ispy3: # 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 @@ else: stdout = sys.stdout stderr = sys.stderr sysargv = sys.argv + sysplatform = sys.platform getcwd = os.getcwd stringio = io.StringIO