summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-01-28 20:54:28 -0500
committerYury Selivanov <yselivanov@sprymix.com>2014-01-28 20:54:28 -0500
commitd0f92ec0fe9d974bf18e252db66ea4fe207e22d3 (patch)
tree484ad0cf3635499a847dc4eb87d597d2cf16d36d /Lib/inspect.py
parent65f4acc72e4ff0aacaee0e17b5daf656c55b4e67 (diff)
downloadcpython-d0f92ec0fe9d974bf18e252db66ea4fe207e22d3.tar.gz
inspect.Signature.bind: Add **kwargs/positional-only check back
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index c3fecb8b8c..0072820601 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: