cmdutils: Assert on positional-only params

This commit is contained in:
Florian Bruhin 2016-08-25 22:14:19 +02:00
parent 8823ed2821
commit be7abb53ad

View File

@ -244,6 +244,12 @@ class Command:
if not self.ignore_args:
for param in signature.parameters.values():
# https://docs.python.org/3/library/inspect.html#inspect.Parameter.kind
# "Python has no explicit syntax for defining positional-only
# parameters, but many built-in and extension module functions
# (especially those that accept only one or two parameters)
# accept them."
assert param.kind != inspect.Parameter.POSITIONAL_ONLY
if param.name == 'self':
continue
if self._inspect_special_param(param):