Don't error unnecessarily about new syntax in dependencies where we ignore errors anyways - #21883
Conversation
dd534bf to
0a7f41f
Compare
|
I would be happy to explain more about the root cause, especially since I never actually made an issue particular to it, but essentially Trio has a lockfile (https://github.com/python-trio/trio/blob/main/test-requirements.txt) that conditionally has newer Sphinx versions that use new typing features. In particular, when I develop locally with my 3.14 Python, after a and this has bothered me forever :-) |
This comment has been minimized.
This comment has been minimized.
0a7f41f to
8187c82
Compare
for more information, see https://pre-commit.ci
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
How does this work with the new parser? Or does this issue only affect the old parser? |
|
Idk, I imagine it only affects old parser since I remember ruff's parser does some error recovery (and so hitting a syntax error won't block parsing the rest) |
|
@A5rocks it looks like there is an epidemic of people not knowing what is going on in their PRs :-) Can you try the new parser? Also please test both with |
|
On master the test case in this PR succeeds, though there's a bug (I think) in the test suite code that requires me to pass So anyways, yes, it seems like only the old parser needs this PR. |
|
OK, I am actually deleting this env var logic in my PR, so I can just merge this, and then the test will naturally switch to new parser when my PR is merged. |
This fixes #21178 (at least my own root cause for it). This is actually a bit trickier than I thought (you can read that issue to see what I thought would work, which was naive!). However, even though we use the
astmodule and cannot make the errors nonblocking, we can work around the root cause of that issue i.e. that new features in dependencies can cause mypy to fail.