Skip to content

Comments

Better support for SomeEnum.item == some_literal#19594

Draft
sterliakov wants to merge 13 commits intopython:masterfrom
sterliakov:bugfix/gh-19576-enum-comparison-overlap
Draft

Better support for SomeEnum.item == some_literal#19594
sterliakov wants to merge 13 commits intopython:masterfrom
sterliakov:bugfix/gh-19576-enum-comparison-overlap

Conversation

@sterliakov
Copy link
Collaborator

@sterliakov sterliakov commented Aug 4, 2025

Fixes #19576.
Fixes #16327.
Fixes #17162.
Fixes #19753.

This needs more feedback: is the logic I propose reasonable? Do we want to be stricter and reject such comparisons altogether? Or maybe only reject them if values are incompatible?

@github-actions

This comment has been minimized.

Copy link
Collaborator

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

I was a bit confused about this in the original issue too

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@sterliakov sterliakov marked this pull request as ready for review August 28, 2025 13:51
Copy link
Collaborator

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

I tried my listed use case against current mypy, which was wrong: #19753

This looks good to me though

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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

@sterliakov
Copy link
Collaborator Author

Draft until I can address #20142 (comment)

@A5rocks
Copy link
Collaborator

A5rocks commented Feb 15, 2026

Probably this has to be recreated to work with new narrowing... and half of the listed issues are closed now!

(not really sure though, I completely forgot what this PR does :/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants