Jeremiah Lowin added the comment:

I created a patch to resolve this. 

If a function has keyword-only arguments, then inspect.getcallargs checks if 
the argument is in kwonlydefaults. However, kwonlydefaults is None if no 
defaults were specified. In that situation, 'kwarg in kwonlydefaults' raises 
the TypeError.

The quick fix is simply to test kwonlydefaults before testing if kwarg is in it.

The test for this situation is a little verbose because a TypeError is expected 
and one is raised, just the wrong one, so I parse the error message.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20816>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to