commit | 42407abe2450819b74b9ccb1fbe99edc78bbbb41 | [log] [tgz] |
---|---|---|
author | Yury Selivanov <yselivanov@sprymix.com> | Mon Jun 23 10:23:50 2014 -0700 |
committer | Yury Selivanov <yselivanov@sprymix.com> | Mon Jun 23 10:23:50 2014 -0700 |
tree | 4ebda4c6d2a697ab25969063485329f50cc60b3a | |
parent | 289cae4f929997bcfe9689c3e9dd7a3be5e5919f [diff] [blame] |
inspect: Validate that __signature__ is None or an instance of Signature. Closes #21801.
diff --git a/Lib/inspect.py b/Lib/inspect.py index 4ac76b1..b9cdcc2 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py
@@ -1939,6 +1939,10 @@ 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: