mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Bypass class attribute lookup for PEP 695 typevars

Open A5rocks opened this issue 1 month ago • 1 comments

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.

A5rocks avatar Nov 23 '25 04:11 A5rocks

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

github-actions[bot] avatar Nov 23 '25 05:11 github-actions[bot]