From 6d6f1c361dc233f16adeb8998a70e2e59cc9bae3 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 7 Feb 2023 12:22:19 +0000 Subject: [PATCH] `subprocess.check_call`: `executable` defaults to `None` 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 "", line 1, in ZeroDivisionError: division by zero Traceback (most recent call last): File "", line 1, in 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. ``` --- stdlib/subprocess.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index bda422d2e6c0..63a6836286b3 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -994,7 +994,7 @@ if sys.version_info >= (3, 11): def check_call( args: _CMD, bufsize: int = ..., - executable: StrOrBytesPath = ..., + executable: StrOrBytesPath | None = None, stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ..., @@ -1025,7 +1025,7 @@ elif sys.version_info >= (3, 10): def check_call( args: _CMD, bufsize: int = ..., - executable: StrOrBytesPath = ..., + executable: StrOrBytesPath | None = None, stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ..., @@ -1055,7 +1055,7 @@ elif sys.version_info >= (3, 9): def check_call( args: _CMD, bufsize: int = ..., - executable: StrOrBytesPath = ..., + executable: StrOrBytesPath | None = None, stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ..., @@ -1083,7 +1083,7 @@ else: def check_call( args: _CMD, bufsize: int = ..., - executable: StrOrBytesPath = ..., + executable: StrOrBytesPath | None = None, stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ...,