Skip to content

Commit 4a8a20f

Browse files
Sterbicmatthiaskramm
authored andcommitted
Allow passing lambdas as init arguments in multiprocessing (#1416)
* Use NoReturn in multiprocessing init functions * Use Any for init functions
1 parent d5eb32d commit 4a8a20f

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

stdlib/3/multiprocessing/context.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@ class BaseContext(object):
4949
def JoinableQueue(self, maxsize: int = ...) -> Any: ...
5050
# TODO: change return to SimpleQueue once a stub exists in multiprocessing.queues
5151
def SimpleQueue(self) -> Any: ...
52-
# TODO: change return to Pool once a stub exists in multiprocessing.pool
5352
def Pool(
5453
self,
5554
processes: Optional[int] = ...,
5655
initializer: Optional[Callable[..., Any]] = ...,
5756
initargs: Tuple = ...,
5857
maxtasksperchild: Optional[int] = ...
59-
) -> Any: ...
58+
) -> multiprocessing.Pool: ...
6059
# TODO: typecode_or_type param is a ctype with a base class of _SimpleCData or array.typecode Need to figure out
6160
# how to handle the ctype
6261
# TODO: change return to RawValue once a stub exists in multiprocessing.sharedctypes

stdlib/3/multiprocessing/managers.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ _Namespace = Namespace
1919
class BaseManager:
2020
def register(self, typeid: str, callable: Any = ...) -> None: ...
2121
def shutdown(self) -> None: ...
22-
def start(self, initializer: Optional[Callable[..., None]] = ...,
22+
def start(self, initializer: Optional[Callable[..., Any]] = ...,
2323
initargs: Iterable[Any] = ...) -> None: ...
2424
def __enter__(self) -> 'BaseManager': ...
2525
def __exit__(self, exc_type, exc_value, tb) -> None: ...

stdlib/3/multiprocessing/pool.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AsyncResult():
1212

1313
class ThreadPool():
1414
def __init__(self, processes: Optional[int] = None,
15-
initializer: Optional[Callable[..., None]] = None,
15+
initializer: Optional[Callable[..., Any]] = None,
1616
initargs: Iterable[Any] = ...) -> None: ...
1717
def apply(self,
1818
func: Callable[..., Any],

0 commit comments

Comments
 (0)