From 3c7510217704891a14c0992ea08969168c8fed99 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 9 Dec 2020 21:42:45 -0500 Subject: [PATCH 1/3] concurrent.futures: add _work_queue property to ThreadPoolExecutor `ThreadPoolExecutor` assigns a `queue.SimpleQueue` to `_work_queue` in it's `__init__` method. https://github.com/python/cpython/blob/7cf0aad96d1d20f07d7f0e374885f327c2d5ff27/Lib/concurrent/futures/thread.py#L144 --- stdlib/3/concurrent/futures/thread.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/3/concurrent/futures/thread.pyi b/stdlib/3/concurrent/futures/thread.pyi index 4b9a8bf6dfbd..e89bee10871c 100644 --- a/stdlib/3/concurrent/futures/thread.pyi +++ b/stdlib/3/concurrent/futures/thread.pyi @@ -13,6 +13,7 @@ if sys.version_info >= (3, 9): _S = TypeVar("_S") class ThreadPoolExecutor(Executor): + _work_queue: Any if sys.version_info >= (3, 7): def __init__( self, From 2ba735a7bd1ff9a9af89239ffe723499fe928eb2 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 9 Dec 2020 21:56:51 -0500 Subject: [PATCH 2/3] use proper types --- stdlib/3/concurrent/futures/thread.pyi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stdlib/3/concurrent/futures/thread.pyi b/stdlib/3/concurrent/futures/thread.pyi index e89bee10871c..b69af6158560 100644 --- a/stdlib/3/concurrent/futures/thread.pyi +++ b/stdlib/3/concurrent/futures/thread.pyi @@ -1,5 +1,6 @@ import sys from typing import Any, Callable, Generic, Iterable, Mapping, Optional, Tuple, TypeVar +import queue from ._base import Executor, Future @@ -13,7 +14,10 @@ if sys.version_info >= (3, 9): _S = TypeVar("_S") class ThreadPoolExecutor(Executor): - _work_queue: Any + if sys.version_info >= (3, 7): + _work_queue: queue.SimpleQueue + else: + _work_queue: queue.Queue if sys.version_info >= (3, 7): def __init__( self, From 6da9e141996f0cfe109c737d7163bde865b461bc Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 9 Dec 2020 21:58:31 -0500 Subject: [PATCH 3/3] isort --- stdlib/3/concurrent/futures/thread.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/3/concurrent/futures/thread.pyi b/stdlib/3/concurrent/futures/thread.pyi index b69af6158560..e8116c6da791 100644 --- a/stdlib/3/concurrent/futures/thread.pyi +++ b/stdlib/3/concurrent/futures/thread.pyi @@ -1,6 +1,6 @@ +import queue import sys from typing import Any, Callable, Generic, Iterable, Mapping, Optional, Tuple, TypeVar -import queue from ._base import Executor, Future