Gracefully handle poorly registered instance methods that take no args (ie: missing self arg)

This commit is contained in:
Tyson Clugg 2015-04-29 19:51:40 +10:00
parent 97cc333c5e
commit 1e99b0c396

View file

@ -33,7 +33,7 @@ def validate_kwargs(func, kwargs):
defaults = list(argspec.defaults or [])
# ignore implicit 'self' argument
if inspect.ismethod(func) and all_args[0] == 'self':
if inspect.ismethod(func) and all_args[:1] == ['self']:
all_args[:1] = []
# don't require arguments that have defaults