Skip to content
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

Fix crash on prefixed paramspec with deferral #14569

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

ilevkivskyi
Copy link
Member

Fixes #14565

The fix looks simple, looks like an obvious omission.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/abc.py:2202: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
- https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
- Please report a bug at https://github.com/python/mypy/issues
- version: 1.0.0+dev.90168b8396bf53f7573e8f0ca198ab33a855e3d2
- tanjun/abc.py:2202: : note: use --pdb to drop into pdb
- tanjun/abc.py:92: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:93: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:94: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:95: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:97: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:98: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:99: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:100: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:102: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:103: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:104: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
- tanjun/abc.py:105: error: Cannot resolve TypeVar upper bound (possible cyclic definition)  [misc]
+ tanjun/_internal/__init__.py:539: error: Incompatible types in assignment (expression has type "Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]", variable has type "Dict[Union[str, _IndexKeys], Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]]")  [assignment]
+ tanjun/_internal/__init__.py:552: error: Item "Dict[Union[str, _IndexKeys], Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]]" of "Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]" has no attribute "append"  [union-attr]
+ tanjun/_internal/__init__.py:616: error: Incompatible types in assignment (expression has type "Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]", variable has type "Dict[Union[str, _IndexKeys], Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]]")  [assignment]
+ tanjun/_internal/__init__.py:664: error: Incompatible types in assignment (expression has type "Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]", variable has type "Dict[Union[str, _IndexKeys], Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]]")  [assignment]
+ tanjun/_internal/__init__.py:677: error: Item "Dict[Union[str, _IndexKeys], Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]]" of "Union[_TreeT, List[Tuple[List[str], MessageCommand[Any]]]]" has no attribute "remove"  [union-attr]
+ tanjun/dependencies/reloaders.py:365: error: Argument 1 to "filter" has incompatible type "Callable[[Path], bool]"; expected "Callable[[Self], TypeGuard[bool]]"  [arg-type]
+ tanjun/dependencies/reloaders.py:365: error: Argument 1 to "map" has incompatible type "Callable[[Self, bool], Self]"; expected "Callable[[Path], Self]"  [arg-type]
+ tanjun/dependencies/reloaders.py:408: error: "ABC" has no attribute "type"  [attr-defined]
+ tanjun/dependencies/reloaders.py:408: error: "ABC" has no attribute "name"  [attr-defined]
+ tanjun/dependencies/reloaders.py:408: error: "ABC" has no attribute "build"  [attr-defined]
+ tanjun/dependencies/reloaders.py:512: error: Incompatible return value type (got "Tuple[Path, Union[Tuple[None, Set[<nothing>]], Tuple[str, Set[<nothing>]]]]", expected "Tuple[Path, Union[Tuple[str, Set[str]], Tuple[None, Set[Path]]]]")  [return-value]
+ tanjun/context/slash.py:1043: error: Signature of "command" incompatible with supertype "Context"  [override]
+ tanjun/context/message.py:130: error: Signature of "command" incompatible with supertype "Context"  [override]
+ tanjun/schedules.py:339: error: Argument 1 to "call_with_async_di" of "Client" has incompatible type "_CallbackSigT"; expected "Callable[..., Union[Coroutine[Any, Any, <nothing>], <nothing>]]"  [arg-type]
+ tanjun/schedules.py:365: error: Argument 1 to "call_with_async_di" of "Client" has incompatible type "Callable[..., Coroutine[Any, Any, None]]"; expected "Callable[..., Union[Coroutine[Any, Any, <nothing>], <nothing>]]"  [arg-type]
+ tanjun/schedules.py:388: error: Argument 1 to "call_with_async_di" of "Client" has incompatible type "Callable[..., Coroutine[Any, Any, None]]"; expected "Callable[..., Union[Coroutine[Any, Any, <nothing>], <nothing>]]"  [arg-type]
+ tanjun/schedules.py:1052: error: Argument 1 to "call_with_async_di" of "Client" has incompatible type "_CallbackSigT"; expected "Callable[..., Union[Coroutine[Any, Any, <nothing>], <nothing>]]"  [arg-type]
+ tanjun/parsing.py:1668: error: Right operand of "and" is never evaluated  [unreachable]
+ tanjun/parsing.py:1669: error: Statement is unreachable  [unreachable]
+ tanjun/parsing.py:1679: error: Statement is unreachable  [unreachable]
+ tanjun/context/menu.py:101: error: Signature of "command" incompatible with supertype "Context"  [override]
+ tanjun/context/menu.py:129: error: Incompatible return value type (got "Unique", expected "Union[InteractionMember, User, Message]")  [return-value]
+ tanjun/context/menu.py:141: error: Incompatible return value type (got "CommandType", expected "Literal[CommandType.USER, CommandType.MESSAGE]")  [return-value]
+ tanjun/context/menu.py:196: error: Argument "default" to "resolve_to_member" of "MenuContext" has incompatible type "None"; expected "User"  [arg-type]
+ tanjun/dependencies/limiters.py:782: error: Argument 1 to "add_pre_execution" of "Hooks" has incompatible type "CooldownPreExecution"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Optional[Coroutine[Any, Any, None]]]"  [arg-type]
+ tanjun/dependencies/limiters.py:782: note: "CooldownPreExecution.__call__" has type "Callable[[Context, Arg(AbstractCooldownManager, 'cooldowns'), DefaultNamedArg(Optional[AbstractLocaliser], 'localiser'), NamedArg(Optional[AbstractOwners], 'owner_check')], Coroutine[Any, Any, None]]"
+ tanjun/dependencies/limiters.py:1137: error: Argument 1 to "add_pre_execution" of "Hooks" has incompatible type "ConcurrencyPreExecution"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Optional[Coroutine[Any, Any, None]]]"  [arg-type]
+ tanjun/dependencies/limiters.py:1137: note: "ConcurrencyPreExecution.__call__" has type "Callable[[Context, Arg(AbstractConcurrencyLimiter, 'limiter'), DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, None]]"
+ tanjun/dependencies/limiters.py:1137: error: Argument 1 to "add_post_execution" of "Hooks" has incompatible type "ConcurrencyPostExecution"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Optional[Coroutine[Any, Any, None]]]"  [arg-type]
+ tanjun/dependencies/limiters.py:1137: note: "ConcurrencyPostExecution.__call__" has type "Callable[[Context, Arg(AbstractConcurrencyLimiter, 'limiter')], Coroutine[Any, Any, None]]"
+ tanjun/checks.py:620: error: Argument 2 to "_optional_kwargs" has incompatible type "DmCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]
+ tanjun/checks.py:620: note: "DmCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], bool]"
+ tanjun/checks.py:686: error: Argument 2 to "_optional_kwargs" has incompatible type "GuildCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]
+ tanjun/checks.py:686: note: "GuildCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], bool]"
+ tanjun/checks.py:748: error: Argument 2 to "_optional_kwargs" has incompatible type "NsfwCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]
+ tanjun/checks.py:748: note: "NsfwCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:810: error: Argument 2 to "_optional_kwargs" has incompatible type "SfwCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]
+ tanjun/checks.py:810: note: "SfwCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:872: error: Argument 2 to "_optional_kwargs" has incompatible type "OwnerCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]
+ tanjun/checks.py:872: note: "OwnerCheck.__call__" has type "Callable[[Context, Arg(AbstractOwners, 'dependency'), DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:927: error: Argument 2 to "_add_to_command" has incompatible type "AuthorPermissionCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]
+ tanjun/checks.py:927: note: "AuthorPermissionCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:983: error: Argument 2 to "_add_to_command" has incompatible type "OwnPermissionCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]"  [arg-type]

... (truncated 100 lines) ...

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix!

@JukkaL JukkaL merged commit c375009 into python:master Feb 1, 2023
@ilevkivskyi ilevkivskyi deleted the fix-prefix-crash branch February 1, 2023 09:57
ilinum pushed a commit to ilinum/mypy that referenced this pull request Feb 2, 2023
Fixes python#14565

The fix looks simple, looks like an obvious omission.
hauntsaninja pushed a commit that referenced this pull request Feb 2, 2023
…#14586)

Fixes #14565

The fix looks simple, looks like an obvious omission.

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New "Must not defer during final iteration" crash
3 participants