Skip to content

Improve sentinel narrowing - #21844

Merged
JelleZijlstra merged 1 commit into
python:masterfrom
cdce8p:sentinel-narrowing
Aug 13, 2026
Merged

Improve sentinel narrowing#21844
JelleZijlstra merged 1 commit into
python:masterfrom
cdce8p:sentinel-narrowing

Conversation

@cdce8p

@cdce8p cdce8p commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Followup to #21647

Adjust test case for equality narrowing. That's already implemented, the test was just using a striped down fixture.
Also add support for narrowing sentinels with in and collections similar to enums.

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

@cdce8p
cdce8p requested a review from JelleZijlstra August 13, 2026 12:19

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fixtures are the bane of our existence. Thanks for improving this!

@JelleZijlstra
JelleZijlstra merged commit b4b8d74 into python:master Aug 13, 2026
25 checks passed
@cdce8p
cdce8p deleted the sentinel-narrowing branch August 13, 2026 15:05
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