From 9c8bc640a3381658f28faaf6353ef1cf0dbfea23 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 4 Nov 2024 06:42:11 -0800 Subject: [PATCH] a couple stubtest fixes in multiprocessing (#12948) --- stdlib/@tests/stubtest_allowlists/common.txt | 2 -- stdlib/multiprocessing/managers.pyi | 3 ++- stdlib/multiprocessing/spawn.pyi | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 080a771fd..f3d4d8e5c 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -74,7 +74,6 @@ ipaddress._BaseNetwork.max_prefixlen multiprocessing.JoinableQueue multiprocessing.Queue multiprocessing.SimpleQueue -multiprocessing.managers.BaseManager.shutdown multiprocessing.managers.SyncManager.Event multiprocessing.managers.SyncManager.Lock multiprocessing.managers.SyncManager.Namespace @@ -82,7 +81,6 @@ multiprocessing.managers.SyncManager.RLock multiprocessing.queues.JoinableQueue.__init__ multiprocessing.queues.Queue.__init__ multiprocessing.queues.SimpleQueue.__init__ -multiprocessing.spawn._main multiprocessing.synchronize.Barrier.__init__ multiprocessing.synchronize.Condition.acquire multiprocessing.synchronize.Condition.release diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index c5a113437..8c65eccad 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -10,6 +10,7 @@ from typing_extensions import Self, TypeAlias from .connection import Connection from .context import BaseContext from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory +from .util import Finalize as _Finalize __all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"] @@ -156,7 +157,7 @@ class BaseManager: def get_server(self) -> Server: ... def connect(self) -> None: ... def start(self, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ()) -> None: ... - def shutdown(self) -> None: ... # only available after start() was called + shutdown: _Finalize # only available after start() was called def join(self, timeout: float | None = None) -> None: ... # undocumented @property def address(self) -> Any: ... diff --git a/stdlib/multiprocessing/spawn.pyi b/stdlib/multiprocessing/spawn.pyi index 43ce2f07d..4a9753222 100644 --- a/stdlib/multiprocessing/spawn.pyi +++ b/stdlib/multiprocessing/spawn.pyi @@ -23,7 +23,7 @@ def get_command_line(**kwds: Any) -> list[str]: ... def spawn_main(pipe_handle: int, parent_pid: int | None = None, tracker_fd: int | None = None) -> None: ... # undocumented -def _main(fd: int) -> Any: ... +def _main(fd: int, parent_sentinel: int) -> int: ... def get_preparation_data(name: str) -> dict[str, Any]: ... old_main_modules: list[ModuleType]