Mercurial > cpython-lru_cache-weakref
changeset 68214:738feec9ced0
Issue #8513: On UNIX, subprocess supports bytes command string.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Thu, 03 Mar 2011 12:54:05 +0000 |
| parents | a4e7fbed753c |
| children | 20a5a08c3b6c |
| files | Lib/subprocess.py Lib/test/test_subprocess.py Misc/NEWS |
| diffstat | 3 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/subprocess.py Thu Mar 03 11:08:33 2011 +0000 +++ b/Lib/subprocess.py Thu Mar 03 12:54:05 2011 +0000 @@ -1125,7 +1125,7 @@ restore_signals, start_new_session): """Execute program (POSIX version)""" - if isinstance(args, str): + if isinstance(args, (str, bytes)): args = [args] else: args = list(args)
--- a/Lib/test/test_subprocess.py Thu Mar 03 11:08:33 2011 +0000 +++ b/Lib/test/test_subprocess.py Thu Mar 03 12:54:05 2011 +0000 @@ -1059,6 +1059,11 @@ 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
--- a/Misc/NEWS Thu Mar 03 11:08:33 2011 +0000 +++ b/Misc/NEWS Thu Mar 03 12:54:05 2011 +0000 @@ -52,6 +52,8 @@ 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
