Skip to content

Commit c46ed0d

Browse files
committed
Simplify non-positional parameter check
1 parent 26a6b87 commit c46ed0d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Tools/clinic/libclinic/dsl_parser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,11 @@ def parse_parameter(self, line: str) -> None:
927927
# (var-positional), then we allow ``**kwds`` (var-keyword).
928928
# Currently, pos-or-keyword or keyword-only arguments are not
929929
# allowed with the ``**kwds`` converter.
930-
if not all(p.is_positional_only() or p.is_vararg()
931-
for p in self.function.parameters.values()):
930+
has_non_positional_param = any(
931+
p.is_positional_or_keyword() or p.is_keyword_only()
932+
for p in self.function.parameters.values()
933+
)
934+
if has_non_positional_param:
932935
fail(f"Function {self.function.name!r} has an "
933936
f"invalid parameter declaration (**kwargs?): {line!r}")
934937
is_var_keyword = True

0 commit comments

Comments
 (0)