summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-21 13:32:24 -0700
committerGitHub <noreply@github.com>2022-06-21 22:32:24 +0200
commit1b8aa7aafd2ac07836777707fd9ba5ffb353eb0c (patch)
tree2522e6300a8d7784f7def20a0a3772c50df5a4e9 /Lib/test
parent4b2d7f3f4e160fdb482eefa377882d1c2c8ccb1b (diff)
downloadcpython-git-1b8aa7aafd2ac07836777707fd9ba5ffb353eb0c.tar.gz
gh-93021: Fix __text_signature__ for __get__ (GH-93023) (GH-94086)
Because of the way wrap_descr_get is written, the second argument to __get__ methods implemented through the wrapper is always optional. (cherry picked from commit 4e08fbcfdfa57ea94091aabdd09413708e3fb2bf) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_types.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 725d80d9ff..d8e7204dc0 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -599,6 +599,12 @@ class TypesTests(unittest.TestCase):
self.assertIsInstance(object.__lt__, types.WrapperDescriptorType)
self.assertIsInstance(int.__lt__, types.WrapperDescriptorType)
+ def test_dunder_get_signature(self):
+ sig = inspect.signature(object.__init__.__get__)
+ self.assertEqual(list(sig.parameters), ["instance", "owner"])
+ # gh-93021: Second parameter is optional
+ self.assertIs(sig.parameters["owner"].default, None)
+
def test_method_wrapper_types(self):
self.assertIsInstance(object().__init__, types.MethodWrapperType)
self.assertIsInstance(object().__str__, types.MethodWrapperType)