@@ -4,14 +4,18 @@ from collections.abc import Callable, Iterable, Sequence
44from ctypes import _CData
55from logging import Logger
66from multiprocessing import popen_fork , popen_forkserver , popen_spawn_posix , popen_spawn_win32 , queues , synchronize
7- from multiprocessing .connection import _ConnectionBase
87from multiprocessing .managers import SyncManager
98from multiprocessing .pool import Pool as _Pool
109from multiprocessing .process import BaseProcess
1110from multiprocessing .sharedctypes import SynchronizedArray , SynchronizedBase
1211from typing import Any , ClassVar , TypeVar , overload
1312from typing_extensions import Literal , TypeAlias
1413
14+ if sys .platform != "win32" :
15+ from multiprocessing .connection import Connection
16+ else :
17+ from multiprocessing .connection import PipeConnection
18+
1519if sys .version_info >= (3 , 8 ):
1620 __all__ = ()
1721else :
@@ -43,7 +47,15 @@ class BaseContext:
4347 def active_children () -> list [BaseProcess ]: ...
4448 def cpu_count (self ) -> int : ...
4549 def Manager (self ) -> SyncManager : ...
46- def Pipe (self , duplex : bool = ...) -> tuple [_ConnectionBase , _ConnectionBase ]: ...
50+
51+ # N.B. Keep this in sync with multiprocessing.connection.Pipe.
52+ # _ConnectionBase is the common base class of Connection and PipeConnection
53+ # and can be used in cross-platform code.
54+ if sys .platform != "win32" :
55+ def Pipe (self , duplex : bool = ...) -> tuple [Connection , Connection ]: ...
56+ else :
57+ def Pipe (self , duplex : bool = ...) -> tuple [PipeConnection , PipeConnection ]: ...
58+
4759 def Barrier (
4860 self , parties : int , action : Callable [..., object ] | None = ..., timeout : float | None = ...
4961 ) -> synchronize .Barrier : ...
0 commit comments