[commands] Properly handle typing.Optional as last positional parameter
This commit is contained in:
1 parent
7fbdc6e83f
commit
0513ea1f53
1 file changed
+2
@@ -413,6 +413,8 @@ class Command(_BaseCommand):
|
||||
if param.kind == param.VAR_POSITIONAL:
|
||||
raise RuntimeError() # break the loop
|
||||
if required:
|
||||
if self._is_typing_optional(param.annotation):
|
||||
return None
|
||||
raise MissingRequiredArgument(param)
|
||||
return param.default
|
||||
|
||||
|
||||
Reference in new issue
Block a user