inspect: Fix getcallargs() to raise correct TypeError

... for missing keyword-only arguments. Patch by Jeremiah Lowin.
Closes #20816.
This commit is contained in:
Yury Selivanov 2014-03-27 18:23:03 -04:00
parent 00abf385ac
commit b1d060bf8b
3 changed files with 12 additions and 1 deletions

View file

@ -1208,7 +1208,7 @@ def getcallargs(*func_and_positional, **named):
missing = 0
for kwarg in kwonlyargs:
if kwarg not in arg2value:
if kwarg in kwonlydefaults:
if kwonlydefaults and kwarg in kwonlydefaults:
arg2value[kwarg] = kwonlydefaults[kwarg]
else:
missing += 1