Skip to content

Commit bff43b5

Browse files
authored
Update asyncio subprocess optional **kwargs (#9177)
1 parent 0e41136 commit bff43b5

File tree

2 files changed

+172
-88
lines changed

2 files changed

+172
-88
lines changed

stdlib/asyncio/subprocess.pyi

+91-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import subprocess
22
import sys
33
from _typeshed import StrOrBytesPath
44
from asyncio import events, protocols, streams, transports
5-
from collections.abc import Callable
5+
from collections.abc import Callable, Collection
66
from typing import IO, Any
77
from typing_extensions import Literal, TypeAlias
88

@@ -40,7 +40,7 @@ class Process:
4040
def kill(self) -> None: ...
4141
async def communicate(self, input: bytes | bytearray | memoryview | None = ...) -> tuple[bytes, bytes]: ...
4242

43-
if sys.version_info >= (3, 10):
43+
if sys.version_info >= (3, 11):
4444
async def create_subprocess_shell(
4545
cmd: str | bytes,
4646
stdin: int | IO[Any] | None = ...,
@@ -65,7 +65,13 @@ if sys.version_info >= (3, 10):
6565
creationflags: int = ...,
6666
restore_signals: bool = ...,
6767
start_new_session: bool = ...,
68-
pass_fds: Any = ...,
68+
pass_fds: Collection[int] = ...,
69+
group: None | str | int = ...,
70+
extra_groups: None | Collection[str | int] = ...,
71+
user: None | str | int = ...,
72+
umask: int = ...,
73+
process_group: int | None = ...,
74+
pipesize: int = ...,
6975
) -> Process: ...
7076
async def create_subprocess_exec(
7177
program: _ExecArg,
@@ -91,10 +97,80 @@ if sys.version_info >= (3, 10):
9197
creationflags: int = ...,
9298
restore_signals: bool = ...,
9399
start_new_session: bool = ...,
94-
pass_fds: Any = ...,
100+
pass_fds: Collection[int] = ...,
101+
group: None | str | int = ...,
102+
extra_groups: None | Collection[str | int] = ...,
103+
user: None | str | int = ...,
104+
umask: int = ...,
105+
process_group: int | None = ...,
106+
pipesize: int = ...,
95107
) -> Process: ...
96108

97-
else:
109+
elif sys.version_info >= (3, 10):
110+
async def create_subprocess_shell(
111+
cmd: str | bytes,
112+
stdin: int | IO[Any] | None = ...,
113+
stdout: int | IO[Any] | None = ...,
114+
stderr: int | IO[Any] | None = ...,
115+
limit: int = ...,
116+
*,
117+
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
118+
universal_newlines: Literal[False] = ...,
119+
shell: Literal[True] = ...,
120+
bufsize: Literal[0] = ...,
121+
encoding: None = ...,
122+
errors: None = ...,
123+
text: Literal[False, None] = ...,
124+
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
125+
executable: StrOrBytesPath | None = ...,
126+
preexec_fn: Callable[[], Any] | None = ...,
127+
close_fds: bool = ...,
128+
cwd: StrOrBytesPath | None = ...,
129+
env: subprocess._ENV | None = ...,
130+
startupinfo: Any | None = ...,
131+
creationflags: int = ...,
132+
restore_signals: bool = ...,
133+
start_new_session: bool = ...,
134+
pass_fds: Collection[int] = ...,
135+
group: None | str | int = ...,
136+
extra_groups: None | Collection[str | int] = ...,
137+
user: None | str | int = ...,
138+
umask: int = ...,
139+
pipesize: int = ...,
140+
) -> Process: ...
141+
async def create_subprocess_exec(
142+
program: _ExecArg,
143+
*args: _ExecArg,
144+
stdin: int | IO[Any] | None = ...,
145+
stdout: int | IO[Any] | None = ...,
146+
stderr: int | IO[Any] | None = ...,
147+
limit: int = ...,
148+
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
149+
universal_newlines: Literal[False] = ...,
150+
shell: Literal[True] = ...,
151+
bufsize: Literal[0] = ...,
152+
encoding: None = ...,
153+
errors: None = ...,
154+
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
155+
text: bool | None = ...,
156+
executable: StrOrBytesPath | None = ...,
157+
preexec_fn: Callable[[], Any] | None = ...,
158+
close_fds: bool = ...,
159+
cwd: StrOrBytesPath | None = ...,
160+
env: subprocess._ENV | None = ...,
161+
startupinfo: Any | None = ...,
162+
creationflags: int = ...,
163+
restore_signals: bool = ...,
164+
start_new_session: bool = ...,
165+
pass_fds: Collection[int] = ...,
166+
group: None | str | int = ...,
167+
extra_groups: None | Collection[str | int] = ...,
168+
user: None | str | int = ...,
169+
umask: int = ...,
170+
pipesize: int = ...,
171+
) -> Process: ...
172+
173+
else: # >= 3.9
98174
async def create_subprocess_shell(
99175
cmd: str | bytes,
100176
stdin: int | IO[Any] | None = ...,
@@ -120,7 +196,11 @@ else:
120196
creationflags: int = ...,
121197
restore_signals: bool = ...,
122198
start_new_session: bool = ...,
123-
pass_fds: Any = ...,
199+
pass_fds: Collection[int] = ...,
200+
group: None | str | int = ...,
201+
extra_groups: None | Collection[str | int] = ...,
202+
user: None | str | int = ...,
203+
umask: int = ...,
124204
) -> Process: ...
125205
async def create_subprocess_exec(
126206
program: _ExecArg,
@@ -147,5 +227,9 @@ else:
147227
creationflags: int = ...,
148228
restore_signals: bool = ...,
149229
start_new_session: bool = ...,
150-
pass_fds: Any = ...,
230+
pass_fds: Collection[int] = ...,
231+
group: None | str | int = ...,
232+
extra_groups: None | Collection[str | int] = ...,
233+
user: None | str | int = ...,
234+
umask: int = ...,
151235
) -> Process: ...

0 commit comments

Comments
 (0)