Skip to content

Conversation

sterliakov
Copy link
Collaborator

Fixes #18507. Fixes #19526. Fixes #19946 (already closed without reproducer, but star imports may cause such issues, testPEP695TypeVarNameClashStarImport fails on current master).

Even if a type parameter is reusing the name from outer scope, it still cannot be a redefinition, so we can safely store it even in presence of unresolved star imports or variables that do not refer to a type.

This comment has been minimized.

@sterliakov sterliakov marked this pull request as ready for review October 17, 2025 01:53
@sterliakov sterliakov requested a review from JukkaL October 17, 2025 01:53
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 don't quite follow your explanation. Are you explaining why it's valid to overwrite a name that's processing?

Copy link
Contributor

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

Copy link
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.

This make sense to me. "Auto-generated" type variables must be always added. I will merge this tomorrow if there are no objections from @JukkaL

@ilevkivskyi ilevkivskyi merged commit 583c5f7 into python:master Oct 20, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants