Skip to content

Fix executor initializer attribute return types - #16805

Merged
srittau merged 2 commits into
python:mainfrom
ibrahimmaq14:fix/11400-executor-initializer
Nov 15, 2026
Merged

srittau merged 2 commits into
python:mainfrom
ibrahimmaq14:fix/11400-executor-initializer

Conversation

@ibrahimmaq14

@ibrahimmaq14 ibrahimmaq14 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #11400.

Change the stored _initializer attributes from Callable[..., None] | None to Callable[..., object] | None to match the constructor annotations, accepting value-returning callbacks while retaining checks for non-callables and mismatched constructor initargs.

CPython stores the callable unchanged and ignores its result (process executor, thread executor through 3.13); the thread attribute was removed in 3.14.

Verified locally:

  • python tests/runtests.py stdlib/concurrent: all checks passed, including pre-commit, structure, mypy, pyright, ty, pyrefly, stubtest, and regression suites.
  • Full stdlib mypy regression suite and focused mypy/pyright cases: Python targets 3.10–3.15.
  • Concurrent stubs: mypy targets 3.10–3.15; pyright, ty, and pyrefly targets 3.10 and 3.14.
  • Runtime smoke tests on CPython 3.11.9 and 3.14.7; stubtest on 3.11.9 (899 modules) and 3.14.7 (the two changed modules).

Agent used: OpenAI Codex.

Copilot AI balanced review requested due to automatic review settings November 14, 2026 21:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

This comment has been minimized.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication.

See tests/REGRESSION.md for more information.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit e0c71b8 into python:main Nov 15, 2026
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProcessPoolExecutor initializer 3.11 overloads return object?

3 participants