1
1
import ctypes
2
2
import sys
3
3
from collections .abc import Callable , Iterable , Sequence
4
- from ctypes import _CData
4
+ from ctypes import _CData , _SimpleCData , c_char
5
5
from logging import Logger , _Level as _LoggingLevel
6
6
from multiprocessing import popen_fork , popen_forkserver , popen_spawn_posix , popen_spawn_win32 , queues , synchronize
7
7
from multiprocessing .managers import SyncManager
8
8
from multiprocessing .pool import Pool as _Pool
9
9
from multiprocessing .process import BaseProcess
10
- from multiprocessing .sharedctypes import Synchronized , SynchronizedArray
10
+ from multiprocessing .sharedctypes import Synchronized , SynchronizedArray , SynchronizedString
11
11
from typing import Any , ClassVar , Literal , TypeVar , overload
12
12
from typing_extensions import TypeAlias
13
13
19
19
__all__ = ()
20
20
21
21
_LockLike : TypeAlias = synchronize .Lock | synchronize .RLock
22
+ _T = TypeVar ("_T" )
22
23
_CT = TypeVar ("_CT" , bound = _CData )
23
24
24
25
class ProcessError (Exception ): ...
@@ -79,6 +80,10 @@ class BaseContext:
79
80
@overload
80
81
def RawArray (self , typecode_or_type : str , size_or_initializer : int | Sequence [Any ]) -> Any : ...
81
82
@overload
83
+ def Value (
84
+ self , typecode_or_type : type [_SimpleCData [_T ]], * args : Any , lock : Literal [True ] | _LockLike = True
85
+ ) -> Synchronized [_T ]: ...
86
+ @overload
82
87
def Value (self , typecode_or_type : type [_CT ], * args : Any , lock : Literal [False ]) -> Synchronized [_CT ]: ...
83
88
@overload
84
89
def Value (self , typecode_or_type : type [_CT ], * args : Any , lock : Literal [True ] | _LockLike = True ) -> Synchronized [_CT ]: ...
@@ -87,6 +92,10 @@ class BaseContext:
87
92
@overload
88
93
def Value (self , typecode_or_type : str | type [_CData ], * args : Any , lock : bool | _LockLike = True ) -> Any : ...
89
94
@overload
95
+ def Array (
96
+ self , typecode_or_type : type [c_char ], size_or_initializer : int | Sequence [Any ], * , lock : Literal [True ] | _LockLike = True
97
+ ) -> SynchronizedString : ...
98
+ @overload
90
99
def Array (
91
100
self , typecode_or_type : type [_CT ], size_or_initializer : int | Sequence [Any ], * , lock : Literal [False ]
92
101
) -> SynchronizedArray [_CT ]: ...
0 commit comments