Skip to content

Replace builtins.ellipsis with types.EllipsisType - #21911

Merged
JelleZijlstra merged 1 commit into
python:masterfrom
hamdanal:ellipsis
Aug 29, 2026
Merged

Replace builtins.ellipsis with types.EllipsisType#21911
JelleZijlstra merged 1 commit into
python:masterfrom
hamdanal:ellipsis

Conversation

@hamdanal

@hamdanal hamdanal commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Part of #8240

Unblocks python/typeshed#15712

The actual change is one line in checkexpr and the other changes are for tests, mostly mechanical.
I used the try except trick used for types.ModuleType in the name lookup so that tests that don't import the types module don't crash with KeyError when they use ... (which is used in almost all tests as empty function body).

Most test changes are caused by modules now correctly resolving to module type instead of object because some fixtures started importing types.

The changes are mine, I only used a coding agent to fix the fine-grained-modules.test and testexportjson.py tests and the missing visitor method.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Comment thread mypy/test/teststubtest.py
Comment thread test-data/unit/fixtures/complex_tuple.pyi
Comment thread test-data/unit/check-basic.test
@JelleZijlstra
JelleZijlstra merged commit 6934a9d into python:master Aug 29, 2026
25 checks passed
@hamdanal
hamdanal deleted the ellipsis branch August 29, 2026 16:47
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.

2 participants