summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-04-23 21:41:56 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-04-23 21:41:56 (GMT)
commit13bb71c38f1830f3fabd45b51bb3747aa841b1cb (patch)
treef904efbb7613223a12088bcd4f85b4f00d64c4bb /Lib/os.py
parent534db4e19f4d03e4bf85520bd44e0bf90fb38ae3 (diff)
downloadcpython-13bb71c38f1830f3fabd45b51bb3747aa841b1cb.zip
cpython-13bb71c38f1830f3fabd45b51bb3747aa841b1cb.tar.gz
cpython-13bb71c38f1830f3fabd45b51bb3747aa841b1cb.tar.bz2
Issue #8391: os.execvpe() and os.getenv() supports unicode with surrogates and
bytes strings for environment keys and values
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 580b983..7672d6f 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -450,6 +450,8 @@ environ = _Environ(environ, _keymap, _putenv, _unsetenv)
def getenv(key, default=None):
"""Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default."""
+ if isinstance(key, bytes):
+ key = key.decode(sys.getfilesystemencoding(), "surrogateescape")
return environ.get(key, default)
__all__.append("getenv")