mypy
mypy copied to clipboard
Bypass class attribute lookup for PEP 695 typevars
Fixes https://github.com/python/mypy/issues/20283
This is a bit gross, but I'm not sure how to better do this. The problem is that we look up class attributes before looking at locals, but then put the type vars in a new locals scope. I guess one idea would be to define the typevars at usage time? But this is less of a change.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅