-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 #14902
Sync typeshed #14902
Conversation
Source commit: python/typeshed@a544b75
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: python#13987 (comment)
This comment has been minimized.
This comment has been minimized.
Mypy_primer analysis
|
_program.py:5: error: Argument 1 to "write" of "IO" has incompatible type "bytes"; expected "str" | ||
_program.py:5: error: No overload variant of "write" of "IO" matches argument type "bytes" | ||
_program.py:5: note: Possible overload variants: | ||
_program.py:5: note: def write(self, str, /) -> int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in error message here is slightly unfortunate; the previous error message was better. It's due to a combination of python/typeshed#9861, which made IO.write
an overloaded method, and #14882, which means that mypy now correctly deduces that only one overload applies in this specific situation.
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
+ sympy/polys/solvers.py:34: error: Cannot infer type of lambda [misc]
+ sympy/polys/solvers.py:34: error: Argument 1 to "staticmethod" has incompatible type "Callable[[Any], Any]"; expected "Callable[[Any, Any, Any, Any, Any, Any], Any]" [arg-type]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/copy.py:464: error: Unused "type: ignore" comment
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/conversion.py:123: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:123: error: Untyped decorator makes function "async_caches" untyped [misc]
- tanjun/conversion.py:129: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:129: error: Untyped decorator makes function "cache_components" untyped [misc]
- tanjun/conversion.py:152: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:152: error: Untyped decorator makes function "intents" untyped [misc]
- tanjun/conversion.py:390: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:454: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:508: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:557: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:602: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:675: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:732: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:784: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:839: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/conversion.py:951: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/parsing.py:463: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/clients.py:1342: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/clients.py:1342: error: Untyped decorator makes function "set_global_commands" untyped [misc]
- tanjun/annotations.py:524: error: Module has no attribute "deprecated" [attr-defined]
- tanjun/annotations.py:524: error: Untyped decorator makes function "default" untyped [misc]
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/main.py:963: error: Unused "type: ignore[arg-type]" comment
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/cog.py:500: error: Incompatible types in assignment (expression has type "Callable[..., Any]", variable has type "FuncT") [assignment]
+ discord/ext/commands/cog.py:500: error: Incompatible types in assignment (expression has type "Callable[[VarArg(Any), KwArg(Any)], Any]", variable has type "FuncT") [assignment]
rich (https://github.com/Textualize/rich)
+ rich/progress.py:173: error: Definition of "writelines" in base class "IOBase" is incompatible with definition in base class "IO" [misc]
pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/_internal/_decorators.py:204: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/_internal/_decorators.py:210: error: Need type annotation for "f_cls" [var-annotated]
+ pydantic/decorators.py:91: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:102: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:113: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:123: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:145: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:161: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:170: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:179: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:189: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:204: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/decorators.py:227: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
+ pydantic/main.py:44: error: "classmethod" expects 3 type arguments, but 1 given [type-arg]
urllib3 (https://github.com/urllib3/urllib3)
+ test/test_ssltransport.py:443: error: Unused "type: ignore" comment
+ test/test_ssltransport.py:443: error: No overload variant of "write" of "IO" matches argument type "bytes" [call-overload]
+ test/test_ssltransport.py:443: note: Error code "call-overload" not covered by "type: ignore" comment
+ test/test_ssltransport.py:443: note: Possible overload variants:
+ test/test_ssltransport.py:443: note: def write(self, str, /) -> int
+ test/test_ssltransport.py:480: error: No overload variant of "write" of "IO" matches argument type "str" [call-overload]
+ test/test_ssltransport.py:480: note: Error code "call-overload" not covered by "type: ignore" comment
+ test/test_ssltransport.py:480: note: Possible overload variants:
+ test/test_ssltransport.py:480: note: def write(self, Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]], /) -> int
+ test/test_ssltransport.py:480: note: def write(self, bytes, /) -> int
|
Source commit: python/typeshed@a544b75.
The automated PR failed again last night due to merge conflicts caused by python/typeshed@28dd6c1: https://github.com/python/mypy/actions/runs/4421332699/jobs/7752003840#step:5:55
misc/sync-typeshed.py
script.