Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix TypeGuard/TypeIs being forgotten when semanal defers #19325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2025

Conversation

brianschubert
Copy link
Collaborator

Fixes #19318

Don't re-analyze type_is/type_guard if the callable's type was successfully analyzed on a previous semanal pass. After the first successful pass, the return type will have been replaced by builtins.bool, so subsequent analysis can't detect Type{Guard,Is}.

Copy link
Contributor

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

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Nice fix, thank you!

@hauntsaninja hauntsaninja merged commit b17027e into python:master Jun 22, 2025
19 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.

TypeIs stops working if there is an error in the TypeIs implementation
2 participants