-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Revert "Infer correct types with overloads of Type[Guard | Is]
#19161
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cc @sobolevn |
Diff from mypy_primer, showing the effect of this PR on open source code: scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/file_api/reply.py:106: error: "DataclassInstance" not callable [operator]
- src/scikit_build_core/file_api/reply.py:106: note: Error code "operator" not covered by "type: ignore" comment
discord.py (https://github.com/Rapptz/discord.py)
- discord/ui/select.py:1075: error: Item "function" of "Callable[[V, Interaction[Any], BaseSelectT], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]" has no attribute "__discord_ui_model_type__" [union-attr]
+ discord/ui/select.py:1075: error: "Callable[[V, Interaction[Any], BaseSelectT], Coroutine[Any, Any, Any]]" has no attribute "__discord_ui_model_type__" [attr-defined]
- discord/ui/select.py:1076: error: Item "function" of "Callable[[V, Interaction[Any], BaseSelectT], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [union-attr]
+ discord/ui/select.py:1076: error: "Callable[[V, Interaction[Any], BaseSelectT], Coroutine[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [attr-defined]
- discord/ui/select.py:1085: error: Item "function" of "Callable[[V, Interaction[Any], BaseSelectT], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [union-attr]
+ discord/ui/select.py:1085: error: "Callable[[V, Interaction[Any], BaseSelectT], Coroutine[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [attr-defined]
- discord/ui/select.py:1087: error: Item "function" of "Callable[[V, Interaction[Any], BaseSelectT], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [union-attr]
+ discord/ui/select.py:1087: error: "Callable[[V, Interaction[Any], BaseSelectT], Coroutine[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [attr-defined]
- discord/ui/select.py:1103: error: Item "function" of "Callable[[V, Interaction[Any], BaseSelectT], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [union-attr]
+ discord/ui/select.py:1103: error: "Callable[[V, Interaction[Any], BaseSelectT], Coroutine[Any, Any, Any]]" has no attribute "__discord_ui_model_kwargs__" [attr-defined]
- discord/ext/tasks/__init__.py:631: error: Incompatible return value type (got "Callable[[Any, BaseException], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]", expected "ET") [return-value]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/commands/commands.py:331: error: Incompatible types in assignment (expression has type "InvokeT", variable has type "None") [assignment]
+ steam/ext/commands/commands.py:339: error: Incompatible types in assignment (expression has type "InvokeT", variable has type "None") [assignment]
- steam/ext/commands/commands.py:324: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", expected "ErrT") [return-value]
- steam/ext/commands/commands.py:331: error: Incompatible types in assignment (expression has type "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", variable has type "None") [assignment]
- steam/ext/commands/commands.py:332: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", expected "InvokeT") [return-value]
- steam/ext/commands/commands.py:339: error: Incompatible types in assignment (expression has type "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", variable has type "None") [assignment]
- steam/ext/commands/commands.py:340: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]", expected "InvokeT") [return-value]
- steam/ext/commands/help.py:138: note: Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]]
+ steam/ext/commands/help.py:138: note: ErrT
- steam/ext/commands/cog.py:180: error: Incompatible return value type (got "Callable[[Any | None, VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, None]] | Callable[[Any | None, VarArg(Any), KwArg(Any)], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]", expected "F") [return-value]
+ steam/ext/commands/bot.py:467: error: Incompatible types in assignment (expression has type "BotInvokeT", variable has type "None") [assignment]
+ steam/ext/commands/bot.py:475: error: Incompatible types in assignment (expression has type "BotInvokeT", variable has type "None") [assignment]
- steam/ext/commands/bot.py:467: error: Incompatible types in assignment (expression has type "Callable[[Context[Any]], CoroutineType[Any, Any, None]] | Callable[[Context[Any]], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]", variable has type "None") [assignment]
- steam/ext/commands/bot.py:468: error: Incompatible return value type (got "Callable[[Context[Any]], CoroutineType[Any, Any, None]] | Callable[[Context[Any]], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]", expected "BotInvokeT") [return-value]
- steam/ext/commands/bot.py:475: error: Incompatible types in assignment (expression has type "Callable[[Context[Any]], CoroutineType[Any, Any, None]] | Callable[[Context[Any]], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]", variable has type "None") [assignment]
- steam/ext/commands/bot.py:476: error: Incompatible return value type (got "Callable[[Context[Any]], CoroutineType[Any, Any, None]] | Callable[[Context[Any]], CoroutineType[Any, Any, Any]] | Callable[..., CoroutineType[Any, Any, Any]]", expected "BotInvokeT") [return-value]
|
sobolevn
approved these changes
May 29, 2025
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.
Thank you!
cdce8p
pushed a commit
to cdce8p/mypy
that referenced
this pull request
May 31, 2025
…hon#19161) This reverts commit 43ea203 (python#17678). The commit caused a regression (python#19139). If we can't fix the regression soon enough, reverting the original change temporarily will at least unblock the mypy public release. The reverted PR can be merged again once the regression is fixed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 43ea203 (#17678).
The commit caused a regression (#19139). If we can't fix the regression soon enough, reverting the original change temporarily will at least unblock the mypy public release. The reverted PR can be merged again once the regression is fixed.