inspect.Signature.bind: Add **kwargs/positional-only check back

This commit is contained in:
Yury Selivanov 2014-01-28 20:54:28 -05:00
parent f40c66334d
commit 9b9ac953c8
1 changed files with 8 additions and 0 deletions

View File

@ -2323,6 +2323,14 @@ class Signature:
format(arg=param_name)) from None
else:
if param.kind == _POSITIONAL_ONLY:
# This should never happen in case of a properly built
# Signature object (but let's have this check here
# to ensure correct behaviour just in case)
raise TypeError('{arg!r} parameter is positional only, '
'but was passed as a keyword'. \
format(arg=param.name))
arguments[param_name] = arg_val
if kwargs: