From: Yury Selivanov Date: Wed, 29 Jan 2014 01:54:28 +0000 (-0500) Subject: inspect.Signature.bind: Add **kwargs/positional-only check back X-Git-Tag: v3.4.0rc1~201 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b9ac953c84a5db1632090cb20ad71e5bb667393;p=thirdparty%2FPython%2Fcpython.git inspect.Signature.bind: Add **kwargs/positional-only check back --- diff --git a/Lib/inspect.py b/Lib/inspect.py index c3fecb8b8cb5..007282060198 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -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: