diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2014-06-23 17:23:50 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2014-06-23 17:23:50 (GMT) |
commit | 42407abe2450819b74b9ccb1fbe99edc78bbbb41 (patch) | |
tree | 4ebda4c6d2a697ab25969063485329f50cc60b3a /Lib/test/test_inspect.py | |
parent | 289cae4f929997bcfe9689c3e9dd7a3be5e5919f (diff) | |
download | cpython-42407abe2450819b74b9ccb1fbe99edc78bbbb41.zip cpython-42407abe2450819b74b9ccb1fbe99edc78bbbb41.tar.gz cpython-42407abe2450819b74b9ccb1fbe99edc78bbbb41.tar.bz2 |
inspect: Validate that __signature__ is None or an instance of Signature.
Closes #21801.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 7ad190b..63bdb15 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -3136,6 +3136,13 @@ class TestMain(unittest.TestCase): self.assertEqual(lines[:-1], inspect.getsource(module).splitlines()) self.assertEqual(err, b'') + def test_custom_getattr(self): + def foo(): + pass + foo.__signature__ = 42 + with self.assertRaises(TypeError): + inspect.signature(foo) + @unittest.skipIf(ThreadPoolExecutor is None, 'threads required to test __qualname__ for source files') def test_qualname_source(self): |