-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync typeshed #14295
Sync typeshed #14295
Conversation
Source commit: python/typeshed@9bddd3a
This is allegedly causing large performance problems, see 13821 typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing to undo. Patching this in typeshed also feels weird, since there's a more general soundness issue. If a typevar has a bound or constraint, we might not want to solve it to a Literal. If we can confirm the performance regression or fix the unsoundness within mypy, I might pursue upstreaming this in typeshed. (Reminder: add this to the sync_typeshed script once merged)
Since the plugin provides superior type checking: #13987 (comment)
Diff from mypy_primer, showing the effect of this PR on open source code: vision (https://github.com/pytorch/vision)
+ torchvision/datasets/utils.py:301: error: Argument "compression" to "ZipFile" has incompatible type "int"; expected "Literal[0, 8, 12, 14]" [arg-type]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:864: error: Argument 3 to "ZipFile" has incompatible type "int"; expected "Literal[0, 8, 12, 14]" [arg-type]
|
The mypy-primer hits are from python/typeshed#9346. |
I was looking at the second issue (code is here). Given that the passed-in value is a "temporary" expression (don't know what the right term is here) that is inherently immutable, shouldn't they be considered I understand that has little to do with the purpose of this PR, syncing typeshed, but nevertheless felt it was worth bringing up. |
That's an instance of the classic https://github.com/python/mypy/issues?q=is%3Aopen+is%3Aissue+label%3Atopic-join-v-union / #12056. |
There's discussion in python/typeshed#9367 about whether the |
Sync typeshed
Source commit:
python/typeshed@9bddd3a
Note that you will need to close and re-open the PR in order to trigger CI.