Skip to content

Commit

Permalink
fix: optional variadic arguments no longer can be stuck in infinite l…
Browse files Browse the repository at this point in the history
…oops (#825)
  • Loading branch information
onerandomusername authored Oct 25, 2022
1 parent a69c1de commit 4f604ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/825.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
|commands| Fix a case where optional variadic arguments could have infinite loops in parsing depending on the user input.
5 changes: 4 additions & 1 deletion disnake/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,10 @@ async def transform(self, ctx: Context, param: inspect.Parameter) -> Any:
try:
argument = view.get_quoted_word()
except ArgumentParsingError as exc:
if self._is_typing_optional(param.annotation):
if (
self._is_typing_optional(param.annotation)
and not param.kind == param.VAR_POSITIONAL
):
view.index = previous
return None
else:
Expand Down

0 comments on commit 4f604ff

Please sign in to comment.