Skip to content

Commit f550c24

Browse files
author
Kevin Kirsche
authored
Add multiprocessing.popen_spawn_win32 submodule (#8428)
1 parent 17e3cf9 commit f550c24

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
from multiprocessing.process import BaseProcess
3+
from typing import ClassVar
4+
5+
from .util import Finalize
6+
7+
if sys.platform == "win32":
8+
__all__ = ["Popen"]
9+
10+
TERMINATE: int
11+
WINEXE: bool
12+
WINSERVICE: bool
13+
WINENV: bool
14+
15+
class Popen:
16+
finalizer: Finalize
17+
method: ClassVar[str]
18+
pid: int
19+
returncode: int | None
20+
sentinel: int
21+
22+
def __init__(self, process_obj: BaseProcess) -> None: ...
23+
def duplicate_for_child(self, handle: int) -> int: ...
24+
def wait(self, timeout: float | None = ...) -> int | None: ...
25+
def poll(self) -> int | None: ...
26+
def terminate(self) -> None: ...
27+
28+
kill = terminate
29+
30+
def close(self) -> None: ...

stdlib/multiprocessing/reduction.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ def dump(obj, file, protocol: Any | None = ...) -> None: ...
2727

2828
if sys.platform == "win32":
2929
if sys.version_info >= (3, 8):
30-
def duplicate(handle, target_process: Any | None = ..., inheritable: bool = ..., *, source_process: Any | None = ...): ...
30+
def duplicate(
31+
handle: int, target_process: int | None = ..., inheritable: bool = ..., *, source_process: int | None = ...
32+
) -> int: ...
3133
else:
32-
def duplicate(handle, target_process: Any | None = ..., inheritable: bool = ...): ...
34+
def duplicate(handle: int, target_process: int | None = ..., inheritable: bool = ...) -> int: ...
3335

3436
def steal_handle(source_pid, handle): ...
3537
def send_handle(conn, handle, destination_pid) -> None: ...

tests/stubtest_allowlists/darwin.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ winsound
4848
ossaudiodev
4949
spwd
5050

51+
# multiprocessing.popen_spawn_win32 exists on Darwin but fail to import
52+
multiprocessing.popen_spawn_win32
53+
5154
# Platform differences that cannot be captured by the type system
5255
os.SCHED_[A-Z_]+
5356
posix.SCHED_[A-Z_]+

tests/stubtest_allowlists/linux.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ msvcrt
3737
winreg
3838
winsound
3939

40+
# multiprocessing.popen_spawn_win32 exists on Linux but fail to import
41+
multiprocessing.popen_spawn_win32
42+
4043
# Aliases for OSError
4144
posix.error.characters_written
4245
resource.error.characters_written

0 commit comments

Comments
 (0)