Commit 56c3598c by Őry Máté

check mandatory args if **kwargs taken too

parent 0e84e705
......@@ -369,10 +369,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
"Command %s got unexpected keyword arguments: %s" % (
unicode(func), ", ".join(unexpected_kwargs)))
if argspec.defaults:
mandatory_args = argspec.args[0:-len(argspec.defaults)]
else:
mandatory_args = argspec.args
if argspec.defaults: # remove those with default value
mandatory_args = mandatory_args[0:-len(argspec.defaults)]
missing_kwargs = set(mandatory_args) - set(args)
if missing_kwargs:
raise TypeError("Command %s missing arguments: %s" % (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment