Skip to content

Commit 60c2733

Browse files
authored
subprocess.(check_)call: add text argument new in 3.7 (#8070)
1 parent 1828ba2 commit 60c2733

File tree

1 file changed

+91
-41
lines changed

1 file changed

+91
-41
lines changed

stdlib/subprocess.pyi

Lines changed: 91 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -407,49 +407,99 @@ else:
407407
) -> CompletedProcess[Any]: ...
408408

409409
# Same args as Popen.__init__
410-
def call(
411-
args: _CMD,
412-
bufsize: int = ...,
413-
executable: StrOrBytesPath | None = ...,
414-
stdin: _FILE = ...,
415-
stdout: _FILE = ...,
416-
stderr: _FILE = ...,
417-
preexec_fn: Callable[[], Any] | None = ...,
418-
close_fds: bool = ...,
419-
shell: bool = ...,
420-
cwd: StrOrBytesPath | None = ...,
421-
env: _ENV | None = ...,
422-
universal_newlines: bool = ...,
423-
startupinfo: Any = ...,
424-
creationflags: int = ...,
425-
restore_signals: bool = ...,
426-
start_new_session: bool = ...,
427-
pass_fds: Any = ...,
428-
*,
429-
timeout: float | None = ...,
430-
) -> int: ...
410+
if sys.version_info >= (3, 7):
411+
def call(
412+
args: _CMD,
413+
bufsize: int = ...,
414+
executable: StrOrBytesPath | None = ...,
415+
stdin: _FILE = ...,
416+
stdout: _FILE = ...,
417+
stderr: _FILE = ...,
418+
preexec_fn: Callable[[], Any] | None = ...,
419+
close_fds: bool = ...,
420+
shell: bool = ...,
421+
cwd: StrOrBytesPath | None = ...,
422+
env: _ENV | None = ...,
423+
universal_newlines: bool = ...,
424+
startupinfo: Any = ...,
425+
creationflags: int = ...,
426+
restore_signals: bool = ...,
427+
start_new_session: bool = ...,
428+
pass_fds: Any = ...,
429+
*,
430+
timeout: float | None = ...,
431+
text: bool | None = ...,
432+
) -> int: ...
433+
434+
else:
435+
def call(
436+
args: _CMD,
437+
bufsize: int = ...,
438+
executable: StrOrBytesPath | None = ...,
439+
stdin: _FILE = ...,
440+
stdout: _FILE = ...,
441+
stderr: _FILE = ...,
442+
preexec_fn: Callable[[], Any] | None = ...,
443+
close_fds: bool = ...,
444+
shell: bool = ...,
445+
cwd: StrOrBytesPath | None = ...,
446+
env: _ENV | None = ...,
447+
universal_newlines: bool = ...,
448+
startupinfo: Any = ...,
449+
creationflags: int = ...,
450+
restore_signals: bool = ...,
451+
start_new_session: bool = ...,
452+
pass_fds: Any = ...,
453+
*,
454+
timeout: float | None = ...,
455+
) -> int: ...
431456

432457
# Same args as Popen.__init__
433-
def check_call(
434-
args: _CMD,
435-
bufsize: int = ...,
436-
executable: StrOrBytesPath = ...,
437-
stdin: _FILE = ...,
438-
stdout: _FILE = ...,
439-
stderr: _FILE = ...,
440-
preexec_fn: Callable[[], Any] | None = ...,
441-
close_fds: bool = ...,
442-
shell: bool = ...,
443-
cwd: StrOrBytesPath | None = ...,
444-
env: _ENV | None = ...,
445-
universal_newlines: bool = ...,
446-
startupinfo: Any = ...,
447-
creationflags: int = ...,
448-
restore_signals: bool = ...,
449-
start_new_session: bool = ...,
450-
pass_fds: Any = ...,
451-
timeout: float | None = ...,
452-
) -> int: ...
458+
if sys.version_info >= (3, 7):
459+
def check_call(
460+
args: _CMD,
461+
bufsize: int = ...,
462+
executable: StrOrBytesPath = ...,
463+
stdin: _FILE = ...,
464+
stdout: _FILE = ...,
465+
stderr: _FILE = ...,
466+
preexec_fn: Callable[[], Any] | None = ...,
467+
close_fds: bool = ...,
468+
shell: bool = ...,
469+
cwd: StrOrBytesPath | None = ...,
470+
env: _ENV | None = ...,
471+
universal_newlines: bool = ...,
472+
startupinfo: Any = ...,
473+
creationflags: int = ...,
474+
restore_signals: bool = ...,
475+
start_new_session: bool = ...,
476+
pass_fds: Any = ...,
477+
timeout: float | None = ...,
478+
*,
479+
text: bool | None = ...,
480+
) -> int: ...
481+
482+
else:
483+
def check_call(
484+
args: _CMD,
485+
bufsize: int = ...,
486+
executable: StrOrBytesPath = ...,
487+
stdin: _FILE = ...,
488+
stdout: _FILE = ...,
489+
stderr: _FILE = ...,
490+
preexec_fn: Callable[[], Any] | None = ...,
491+
close_fds: bool = ...,
492+
shell: bool = ...,
493+
cwd: StrOrBytesPath | None = ...,
494+
env: _ENV | None = ...,
495+
universal_newlines: bool = ...,
496+
startupinfo: Any = ...,
497+
creationflags: int = ...,
498+
restore_signals: bool = ...,
499+
start_new_session: bool = ...,
500+
pass_fds: Any = ...,
501+
timeout: float | None = ...,
502+
) -> int: ...
453503

454504
if sys.version_info >= (3, 7):
455505
# 3.7 added text

0 commit comments

Comments
 (0)