diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-23 21:41:56 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-23 21:41:56 (GMT) |
commit | 13bb71c38f1830f3fabd45b51bb3747aa841b1cb (patch) | |
tree | f904efbb7613223a12088bcd4f85b4f00d64c4bb /Lib/subprocess.py | |
parent | 534db4e19f4d03e4bf85520bd44e0bf90fb38ae3 (diff) | |
download | cpython-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/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index b8bcd5e..ff615d3 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1090,7 +1090,10 @@ class Popen(object): 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 |