Skip to content

Commit 32c575d

Browse files
authored
subprocess.check_call: executable defaults to None (#9689)
This argument is forwarded on to `Popen.__init__`, like most of the other arguments. It can be `None`, just like the `executable` parameter for all the other `subprocess` functions: ```pycon >>> import subprocess >>> subprocess.check_call(["python", "-c", "1/1"], executable=None) 0 >>> subprocess.check_call(["python", "-c", "1/0"], executable=None) Traceback (most recent call last): File "<string>", line 1, in <module> ZeroDivisionError: division by zero Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\alexw\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['python', '-c', '1/0']' returned non-zero exit status 1. ```
1 parent 53747b2 commit 32c575d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/subprocess.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ if sys.version_info >= (3, 11):
994994
def check_call(
995995
args: _CMD,
996996
bufsize: int = ...,
997-
executable: StrOrBytesPath = ...,
997+
executable: StrOrBytesPath | None = None,
998998
stdin: _FILE = ...,
999999
stdout: _FILE = ...,
10001000
stderr: _FILE = ...,
@@ -1025,7 +1025,7 @@ elif sys.version_info >= (3, 10):
10251025
def check_call(
10261026
args: _CMD,
10271027
bufsize: int = ...,
1028-
executable: StrOrBytesPath = ...,
1028+
executable: StrOrBytesPath | None = None,
10291029
stdin: _FILE = ...,
10301030
stdout: _FILE = ...,
10311031
stderr: _FILE = ...,
@@ -1055,7 +1055,7 @@ elif sys.version_info >= (3, 9):
10551055
def check_call(
10561056
args: _CMD,
10571057
bufsize: int = ...,
1058-
executable: StrOrBytesPath = ...,
1058+
executable: StrOrBytesPath | None = None,
10591059
stdin: _FILE = ...,
10601060
stdout: _FILE = ...,
10611061
stderr: _FILE = ...,
@@ -1083,7 +1083,7 @@ else:
10831083
def check_call(
10841084
args: _CMD,
10851085
bufsize: int = ...,
1086-
executable: StrOrBytesPath = ...,
1086+
executable: StrOrBytesPath | None = None,
10871087
stdin: _FILE = ...,
10881088
stdout: _FILE = ...,
10891089
stderr: _FILE = ...,

0 commit comments

Comments
 (0)