diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2014-06-23 17:21:04 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2014-06-23 17:21:04 (GMT) |
commit | c0f964fd55b0c5dbc8af895394258784735f1189 (patch) | |
tree | d936e99ea3bae8c2b207c024b6dc13b649d84e47 /Lib/test/test_inspect.py | |
parent | 751c7c0f2db30a8a29383ec105d200991c209fe8 (diff) | |
download | cpython-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/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 1ede3b5..da0572d 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -3048,6 +3048,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): |