Skip to content

Commit

Permalink
Fix a bug which allows more than one varargs
Browse files Browse the repository at this point in the history
Python allows at most *one* vararg in one function.
Remove the improper varargs check which allows function definition like
```
    *vararg1: object
    *vararg2: object
```
in argument clinic.
  • Loading branch information
colorfulappl committed Mar 24, 2022
1 parent 3ac4e78 commit 6793f38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def output_templates(self, f):
vararg = NO_VARARG
pos_only = min_pos = max_pos = min_kw_only = pseudo_args = 0
for i, p in enumerate(parameters, 1):
if p.is_keyword_only() or vararg != NO_VARARG:
if p.is_keyword_only():
assert not p.is_positional_only()
if not p.is_optional():
min_kw_only = i - max_pos
Expand Down

0 comments on commit 6793f38

Please sign in to comment.