mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
inspect: Validate that __signature__ is None or an instance of Signature.
Closes #21801.
This commit is contained in:
parent
751c7c0f2d
commit
c0f964fd55
3 changed files with 13 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue