summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-06-23 17:21:04 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-06-23 17:21:04 (GMT)
commitc0f964fd55b0c5dbc8af895394258784735f1189 (patch)
treed936e99ea3bae8c2b207c024b6dc13b649d84e47 /Lib/inspect.py
parent751c7c0f2db30a8a29383ec105d200991c209fe8 (diff)
downloadcpython-c0f964fd55b0c5dbc8af895394258784735f1189.zip
cpython-c0f964fd55b0c5dbc8af895394258784735f1189.tar.gz
cpython-c0f964fd55b0c5dbc8af895394258784735f1189.tar.bz2
inspect: Validate that __signature__ is None or an instance of Signature.
Closes #21801.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 4c3e33d..f6e1b47 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1912,6 +1912,10 @@ def _signature_internal(obj, follow_wrapper_chains=True, skip_bound_arg=True):
pass
else:
if sig is not None:
+ if not isinstance(sig, Signature):
+ raise TypeError(
+ 'unexpected object {!r} in __signature__ '
+ 'attribute'.format(sig))
return sig
try: