From 8b58371278078d50c85128d74b1fc10c24029d21 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 21 May 2022 08:07:50 -0700 Subject: [PATCH] subprocess: new params in 3.11 (#7907) --- stdlib/subprocess.pyi | 9 +++++++-- tests/stubtest_allowlists/py311.txt | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 83178e15d..5e63292e8 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -1652,8 +1652,13 @@ class Popen(Generic[AnyStr]): def __class_getitem__(cls, item: Any) -> GenericAlias: ... # The result really is always a str. -def getstatusoutput(cmd: _TXT) -> tuple[int, str]: ... -def getoutput(cmd: _TXT) -> str: ... +if sys.version_info >= (3, 11): + def getstatusoutput(cmd: _TXT, *, encoding: str | None = ..., errors: str | None = ...) -> tuple[int, str]: ... + def getoutput(cmd: _TXT, *, encoding: str | None = ..., errors: str | None = ...) -> str: ... + +else: + def getstatusoutput(cmd: _TXT) -> tuple[int, str]: ... + def getoutput(cmd: _TXT) -> str: ... if sys.version_info >= (3, 8): def list2cmdline(seq: Iterable[StrOrBytesPath]) -> str: ... # undocumented diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index b9246f7ea..3c4825920 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -83,8 +83,6 @@ shutil.rmtree socketserver.UDPServer.allow_reuse_port string.Template.get_identifiers string.Template.is_valid -subprocess.getoutput -subprocess.getstatusoutput symtable.SymbolTable.has_exec sys.UnraisableHookArgs # Not exported from sys sys.exception