py3kcompat: don't convert os.environ to bytes
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 10 May 2014 15:22:04 -0700
changeset 21291 007d276f8c94
parent 21290 74be3fb1e3b8
child 21292 a7a9d84f5e4a
py3kcompat: don't convert os.environ to bytes os.environ accepts str not bytes. Assigning bytes will result in a run-time error.
mercurial/py3kcompat.py
--- a/mercurial/py3kcompat.py	Sat May 10 14:57:25 2014 -0700
+++ b/mercurial/py3kcompat.py	Sat May 10 15:22:04 2014 -0700
@@ -52,13 +52,6 @@
     return ret.encode('utf-8', 'surrogateescape')
 builtins.bytesformatter = bytesformatter
 
-# Create bytes equivalents for os.environ values
-for key in list(os.environ.keys()):
-    # UTF-8 is fine for us
-    bkey = key.encode('utf-8', 'surrogateescape')
-    bvalue = os.environ[key].encode('utf-8', 'surrogateescape')
-    os.environ[bkey] = bvalue
-
 origord = builtins.ord
 def fakeord(char):
     if isinstance(char, int):