]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 19 Oct 2021 22:07:13 +0000 (15:07 -0700)
committerGitHub <noreply@github.com>
Tue, 19 Oct 2021 22:07:13 +0000 (00:07 +0200)
commitc15ba304f35362470e29ea5626fed28366bc9571
tree472cb2821774b2b4c4d2453211423c8cca6c1532
parent5c9cab595e56aeb118bff77ece784dbac30b4338
bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034) (GH-29072)

In Python 3.8 and 3.9, stacking `@functools.singledispatchmethod` on top of
`@classmethod` or `@staticmethod` caused an exception to be raised if the
method was registered using type-annotations rather than
`@method.register(int)`. This was not caught by unit tests, however, as the
tests only tested the `@method.register(int)` way of registering additional
implementations. The bug is no longer present in Python 3.10+, but
`test_functools.py` is still lacking regression tests for these cases. This
commit adds these test cases.
(cherry picked from commit ad6d162e518963711d24c80f1b7d6079bd437584)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Lib/test/test_functools.py
Misc/NEWS.d/next/Tests/2021-10-18-16-18-41.bpo-39679.F18qcE.rst [new file with mode: 0644]