python / python/typeshed

concurrent.futures: Bad signature for Executor.submit() under Python <= 3.8

Open
#7,750 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

Reproducer

python3.8 -m venv /tmp/py38
source /tmp/py38/bin/activate
pip -q install mypy
stubtest concurrent.futures

Tentative fix

diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi
index 5b756d87..fc6a342c 100644
--- a/stdlib/concurrent/futures/_base.pyi
+++ b/stdlib/concurrent/futures/_base.pyi
@@ -60,7 +60,7 @@ class Future(Generic[_T]):
         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
 
 class Executor:
-    if sys.version_info >= (3, 9):
+    if sys.version_info >= (3, 8):
         def submit(self, __fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ...
     else:
         def submit(self, fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in stdlib/concurrent/futures/_base.pyi and reproduce the issue with the Python 3.8 virtual environment and the stubtest concurrent.futures command shown above. Check the Executor.submit() signature condition for Python 3.8, and consider the issue complete when stubtest reports the correct signature on Python <= 3.8.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.