mirror of
https://github.com/python/cpython.git
synced 2025-10-06 07:02:33 +00:00
Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)" (GH-5912) (GH-5931)
* Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)" This reverts commitdd42cb71f2
. (cherry picked from commitbe50a7b627
) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
88369bf545
commit
b7dcae358e
4 changed files with 9 additions and 51 deletions
|
@ -1097,12 +1097,7 @@ class Popen(object):
|
|||
assert not pass_fds, "pass_fds not supported on Windows."
|
||||
|
||||
if not isinstance(args, str):
|
||||
try:
|
||||
args = os.fsdecode(args) # os.PathLike -> str
|
||||
except TypeError: # not an os.PathLike, must be a sequence.
|
||||
args = list(args)
|
||||
args[0] = os.fsdecode(args[0]) # os.PathLike -> str
|
||||
args = list2cmdline(args)
|
||||
args = list2cmdline(args)
|
||||
|
||||
# Process startup details
|
||||
if startupinfo is None:
|
||||
|
@ -1374,10 +1369,7 @@ class Popen(object):
|
|||
if isinstance(args, (str, bytes)):
|
||||
args = [args]
|
||||
else:
|
||||
try:
|
||||
args = list(args)
|
||||
except TypeError: # os.PathLike instead of a sequence?
|
||||
args = [os.fsencode(args)] # os.PathLike -> [str]
|
||||
args = list(args)
|
||||
|
||||
if shell:
|
||||
# On Android the default shell is at '/system/bin/sh'.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue