Skip to content

Narrowing for final type objects#20661

Merged
JukkaL merged 1 commit into
python:masterfrom
hauntsaninja:narrow41
Jan 28, 2026
Merged

Narrowing for final type objects#20661
JukkaL merged 1 commit into
python:masterfrom
hauntsaninja:narrow41

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

Fixes #20590
Fixes #15553
Closes #20627
Closes #15646

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/raises.py:1486: error: Unused "type: ignore" comment  [unused-ignore]

trio (https://github.com/python-trio/trio)
+ src/trio/_core/_local.py:54: error: Unused "type: ignore" comment  [unused-ignore]
+ src/trio/_core/_local.py:57: error: Unused "type: ignore" comment  [unused-ignore]

@JukkaL JukkaL 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.

Nice!

@JukkaL JukkaL merged commit 596a288 into python:master Jan 28, 2026
23 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.

Narrowing types does not consider the @final decorator Narrow x is Sentinel where x is Union[type[Sentinel], ...] and Sentinel is @final

2 participants