diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-03-03 12:54:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-03-03 12:54:05 (GMT) |
commit | 7b3b20ad29be6d77608b4bd9cd09b61b67783bcf (patch) | |
tree | 87a6e7e58d31f67e741226aa880043833525b061 | |
parent | 8370bb952809f72b387f11e58aa7b0452e383915 (diff) | |
download | cpython-7b3b20ad29be6d77608b4bd9cd09b61b67783bcf.zip cpython-7b3b20ad29be6d77608b4bd9cd09b61b67783bcf.tar.gz cpython-7b3b20ad29be6d77608b4bd9cd09b61b67783bcf.tar.bz2 |
Issue #8513: On UNIX, subprocess supports bytes command string.
-rw-r--r-- | Lib/subprocess.py | 2 | ||||
-rw-r--r-- | Lib/test/test_subprocess.py | 5 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index c02fb52..359dc96 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1125,7 +1125,7 @@ class Popen(object): restore_signals, start_new_session): """Execute program (POSIX version)""" - if isinstance(args, str): + if isinstance(args, (str, bytes)): args = [args] else: args = list(args) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 9e267eb..d91a4a6 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1059,6 +1059,11 @@ class POSIXProcessTestCase(BaseTestCase): exitcode = subprocess.call([abs_program, "-c", "pass"]) self.assertEqual(exitcode, 0) + # absolute bytes path as a string + cmd = b"'" + abs_program + b"' -c pass" + exitcode = subprocess.call(cmd, shell=True) + self.assertEqual(exitcode, 0) + # bytes program, unicode PATH env = os.environ.copy() env["PATH"] = path @@ -52,6 +52,8 @@ Core and Builtins Library ------- +- Issue #8513: On UNIX, subprocess supports bytes command string. + - Issue #10866: Add socket.sethostname(). Initial patch by Ross Lagerwall. - Issue #11140: Lock.release() now raises a RuntimeError when attempting |