Skip to content

Allow dangerous identity comparisons to Any typed variables#21142

Merged
hauntsaninja merged 3 commits intopython:masterfrom
hauntsaninja:strictequalsentinel
Apr 2, 2026
Merged

Allow dangerous identity comparisons to Any typed variables#21142
hauntsaninja merged 3 commits intopython:masterfrom
hauntsaninja:strictequalsentinel

Conversation

@hauntsaninja
Copy link
Copy Markdown
Collaborator

Fixes #21134

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

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

Copy link
Copy Markdown
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

TBH this is a hack, but I can't come up with anything better, so I guess this is fine as a quick fix.

@hauntsaninja hauntsaninja merged commit d7e3268 into python:master Apr 2, 2026
24 checks passed
@hauntsaninja hauntsaninja deleted the strictequalsentinel branch April 2, 2026 19:06
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.

[1.20 regression] Any is incorrectly narrowed after is comparison

2 participants