summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-01-29 01:54:28 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-01-29 01:54:28 (GMT)
commit9b9ac953c84a5db1632090cb20ad71e5bb667393 (patch)
tree0e101b5af87d1f054a2d4782e2d1f75180f10994
parentf40c66334d175b34143609c0926346c793d089b2 (diff)
downloadcpython-9b9ac953c84a5db1632090cb20ad71e5bb667393.zip
cpython-9b9ac953c84a5db1632090cb20ad71e5bb667393.tar.gz
cpython-9b9ac953c84a5db1632090cb20ad71e5bb667393.tar.bz2
inspect.Signature.bind: Add **kwargs/positional-only check back
-rw-r--r--Lib/inspect.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index c3fecb8..0072820 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: