Skip to content

Commit

Permalink
fix: when *varargs used, it caused incorrect function dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jnoortheen committed Dec 4, 2020
1 parent 3bc2757 commit 0209820
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arger/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ def _dispatch(ns: ap.Namespace):
args = []
for arg_name, arg in self.args.items():
val = getattr(ns, arg_name)
if arg.kind == inspect.Parameter.POSITIONAL_ONLY:
if arg.kind in {
inspect.Parameter.POSITIONAL_ONLY,
inspect.Parameter.POSITIONAL_OR_KEYWORD,
}:
args.append(val)
elif arg.kind == inspect.Parameter.VAR_POSITIONAL:
args.extend(val)
Expand Down

0 comments on commit 0209820

Please sign in to comment.