summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
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")