From 9941616b9efd31181bf3e5dd1d5f375791352fec Mon Sep 17 00:00:00 2001 From: crusaderky Date: Thu, 20 Jun 2019 18:42:26 +0100 Subject: [PATCH] Add mp_context parameter to concurrent.futures.ProcessPoolExecutor (#3078) Closes #3076 --- stdlib/3/concurrent/futures/_base.pyi | 2 +- stdlib/3/concurrent/futures/process.pyi | 5 ++++- stdlib/3/concurrent/futures/thread.pyi | 2 +- third_party/2/concurrent/futures/_base.pyi | 2 +- third_party/2/concurrent/futures/process.pyi | 5 ++++- third_party/2/concurrent/futures/thread.pyi | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 95189a741..13037d87f 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -1,4 +1,4 @@ -from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set, NamedTuple +from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set from types import TracebackType import sys diff --git a/stdlib/3/concurrent/futures/process.pyi b/stdlib/3/concurrent/futures/process.pyi index ba0cd61a6..ca22879c0 100644 --- a/stdlib/3/concurrent/futures/process.pyi +++ b/stdlib/3/concurrent/futures/process.pyi @@ -1,5 +1,5 @@ from typing import Any, Callable, Optional, Tuple -from ._base import Future, Executor +from ._base import Executor import sys EXTRA_QUEUED_CALLS: Any @@ -8,8 +8,11 @@ if sys.version_info >= (3,): class BrokenProcessPool(RuntimeError): ... if sys.version_info >= (3, 7): + from multiprocessing.context import BaseContext + class ProcessPoolExecutor(Executor): def __init__(self, max_workers: Optional[int] = ..., + mp_context: Optional[BaseContext] = ..., initializer: Optional[Callable[..., None]] = ..., initargs: Tuple[Any, ...] = ...) -> None: ... else: diff --git a/stdlib/3/concurrent/futures/thread.pyi b/stdlib/3/concurrent/futures/thread.pyi index 983594dc7..e2b236b8d 100644 --- a/stdlib/3/concurrent/futures/thread.pyi +++ b/stdlib/3/concurrent/futures/thread.pyi @@ -1,5 +1,5 @@ from typing import Any, Callable, Optional, Tuple -from ._base import Executor, Future +from ._base import Executor import sys class ThreadPoolExecutor(Executor): diff --git a/third_party/2/concurrent/futures/_base.pyi b/third_party/2/concurrent/futures/_base.pyi index 95189a741..13037d87f 100644 --- a/third_party/2/concurrent/futures/_base.pyi +++ b/third_party/2/concurrent/futures/_base.pyi @@ -1,4 +1,4 @@ -from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set, NamedTuple +from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set from types import TracebackType import sys diff --git a/third_party/2/concurrent/futures/process.pyi b/third_party/2/concurrent/futures/process.pyi index ba0cd61a6..ca22879c0 100644 --- a/third_party/2/concurrent/futures/process.pyi +++ b/third_party/2/concurrent/futures/process.pyi @@ -1,5 +1,5 @@ from typing import Any, Callable, Optional, Tuple -from ._base import Future, Executor +from ._base import Executor import sys EXTRA_QUEUED_CALLS: Any @@ -8,8 +8,11 @@ if sys.version_info >= (3,): class BrokenProcessPool(RuntimeError): ... if sys.version_info >= (3, 7): + from multiprocessing.context import BaseContext + class ProcessPoolExecutor(Executor): def __init__(self, max_workers: Optional[int] = ..., + mp_context: Optional[BaseContext] = ..., initializer: Optional[Callable[..., None]] = ..., initargs: Tuple[Any, ...] = ...) -> None: ... else: diff --git a/third_party/2/concurrent/futures/thread.pyi b/third_party/2/concurrent/futures/thread.pyi index 983594dc7..e2b236b8d 100644 --- a/third_party/2/concurrent/futures/thread.pyi +++ b/third_party/2/concurrent/futures/thread.pyi @@ -1,5 +1,5 @@ from typing import Any, Callable, Optional, Tuple -from ._base import Executor, Future +from ._base import Executor import sys class ThreadPoolExecutor(Executor):