Mercurial > cpython-lru_cache-weakref
diff Lib/subprocess.py @ 60902:dc8c8d54504e
Issue #8391: os.execvpe() and os.getenv() supports unicode with surrogates and
bytes strings for environment keys and values
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Fri, 23 Apr 2010 21:41:56 +0000 |
| parents | 8428eaa2d3ad |
| children | 64461f68a10e |
line wrap: on
line diff
--- a/Lib/subprocess.py Fri Apr 23 20:33:55 2010 +0000 +++ b/Lib/subprocess.py Fri Apr 23 21:41:56 2010 +0000 @@ -1090,7 +1090,10 @@ fs_encoding = sys.getfilesystemencoding() def fs_encode(s): """Encode s for use in the env, fs or cmdline.""" - return s.encode(fs_encoding, 'surrogateescape') + if isinstance(s, bytes): + return s + else: + return s.encode(fs_encoding, 'surrogateescape') # We must avoid complex work that could involve # malloc or free in the child process to avoid
