# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-12-18 21:05:38 # Node ID bb0d5aad761a09a5002ffe5a393ef5fb449052e5 # Parent 69459fdf3b1b06e4add68d4dbd36a585d818f3b1 py3: have bytes version of os.getenv os.getenv() on python 3 deals with unicodes. If we want to pass bytes. we have os.getenvb() which deals with bytes. This patch adds up a pycompat.osgetenv which deals with bytes on both python 2 and 3. diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -45,6 +45,7 @@ if ispy3: ospathsep = os.pathsep.encode('ascii') ossep = os.sep.encode('ascii') osaltsep = os.altsep + osgetenv = os.getenvb if osaltsep: osaltsep = osaltsep.encode('ascii') # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which @@ -156,6 +157,7 @@ else: sysargv = sys.argv sysplatform = sys.platform getcwd = os.getcwd + osgetenv = os.getenv stringio = io.StringIO empty = _queue.Empty