From a48c1787fd9f673182f54cdf0a456256bfe8bd45 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 6 Oct 2025 14:11:10 +0300 Subject: [PATCH] gh-133210: Fix `test_inspect` without docstrings --- Lib/test/test_inspect/test_inspect.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py index 555efb78dcc6aa..e32e34c63b5324 100644 --- a/Lib/test/test_inspect/test_inspect.py +++ b/Lib/test/test_inspect/test_inspect.py @@ -4261,8 +4261,14 @@ def __init__(self, a): self.assertEqual(self.signature(C, follow_wrapped=False), varargs_signature) - self.assertEqual(self.signature(C.__new__, follow_wrapped=False), - varargs_signature) + if support.MISSING_C_DOCSTRINGS: + self.assertRaisesRegex( + ValueError, "no signature found", + self.signature, C.__new__, follow_wrapped=False, + ) + else: + self.assertEqual(self.signature(C.__new__, follow_wrapped=False), + varargs_signature) def test_signature_on_class_with_wrapped_new(self): with self.subTest('FunctionType'):