| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Sorry, something went wrong.
There was a problem hiding this comment.
Makes sense! I'm surprised by visible selfcheck improvement, though: if there is any, maybe something is wrong, mypy doesn't have a lot of non-stub dependencies... One question (I'm not very familiar with that part, sorry it it's dumb): can this change cause any issues with PEP695 variance inference? Probably not, all self attribute assignments should be retained here, but I'd better ask
Sorry, something went wrong.
| # in the signature we can simply drop the first argument. | ||
| self.is_trivial_self = False | ||
| # Keep track of functions where self attributes are defined. | ||
| self.has_self_attr_def = False |
There was a problem hiding this comment.
Wow, I love this. Can we use this flag later to fix overly optimistic narrowing like in #17537? (even just "this method has an explicit assignment to self" would be better than nothing, but even tracking nested method calls should be doable)
Sorry, something went wrong.
There was a problem hiding this comment.
FWIW we can, but with great care (it is one thing to do something as an optimization, and another thing to do the same for correctness).
Sorry, something went wrong.
There was a problem hiding this comment.
Nice!
re self check: naively my guess would just be pytest
Sorry, something went wrong.
I think no. (also we are already doing this in a lot of cases, this PR simply increases the number of scenarios where we can do this) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
A while ago we started stripping function bodies when checking third-party libraries. This PR pushes this idea further:
In total this makes e.g. mypy -c 'import torch' ~10% faster. Surprisingly, this also has some visible impact on self-check.