https://github.com/python/cpython/commit/ea1ecf6504f4dd9e9eecc401c2d2242140cab0cd commit: ea1ecf6504f4dd9e9eecc401c2d2242140cab0cd branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-01-11T19:47:05Z summary:
[3.13] gh-127750: Fix annotations in singledispatchmethod signature tests (GH-143571) (GH-143708) These tests relied on a bug -- gh-84644, which is that singledispatch doesn't verify the annotation is on the "first" parameter. (cherry picked from commit 620a5b92693ac1b2cef1f90fd3c2dba1bb794552) Co-authored-by: Bartosz Sławecki <[email protected]> files: M Lib/test/test_functools.py diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index a204fd9aaf9702..e042a7909ef05b 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -3151,16 +3151,11 @@ def _(item: int, arg: bytes) -> str: def test_method_signatures(self): class A: - def m(self, item, arg: int) -> str: - return str(item) - @classmethod - def cm(cls, item, arg: int) -> str: - return str(item) @functools.singledispatchmethod def func(self, item, arg: int) -> str: return str(item) @func.register - def _(self, item, arg: bytes) -> str: + def _(self, item: int, arg: bytes) -> str: return str(item) @functools.singledispatchmethod @@ -3169,7 +3164,7 @@ def cls_func(cls, item, arg: int) -> str: return str(arg) @func.register @classmethod - def _(cls, item, arg: bytes) -> str: + def _(cls, item: int, arg: bytes) -> str: return str(item) @functools.singledispatchmethod @@ -3178,7 +3173,7 @@ def static_func(item, arg: int) -> str: return str(arg) @func.register @staticmethod - def _(item, arg: bytes) -> str: + def _(item: int, arg: bytes) -> str: return str(item) self.assertEqual(str(Signature.from_callable(A.func)), _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
