Skip to content

Conversation

@ilevkivskyi
Copy link
Member

Fixes #20326

Type variables with forward references in upper bound are known to be problematic. Existing mechanisms to work with them implicitly assumed that they are used in the same module where they are defined, which is not necessarily the case for "old-style" type variables that can be imported.

Note that the simplification I made in semanal_typeargs.py would be probably sufficient to fix this, but that would be papering over the real issue, so I am making a bit more principled fix.

@github-actions
Copy link
Contributor

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

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.

mypy INTERNAL ERROR in subtyping

2 participants