This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: `functools.singledispatchmethod` is missing tests (and is buggy in 3.9)
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: AlexWaygood, lukasz.langa, miss-islington, rhettinger
Priority: normal Keywords: patch

Created on 2021-10-30 12:10 by AlexWaygood, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29328 merged AlexWaygood, 2021-10-30 12:16
PR 29390 merged miss-islington, 2021-11-03 16:12
PR 29391 closed miss-islington, 2021-11-03 16:12
PR 29394 merged AlexWaygood, 2021-11-03 19:32
PR 29412 merged AlexWaygood, 2021-11-04 20:09
PR 29424 merged miss-islington, 2021-11-05 10:06
Messages (9)
msg405366 - (view) Author: Alex Waygood (AlexWaygood) * (Python triager) Date: 2021-10-30 12:10
`test_functools` includes a test to check that `functools.singledispatch` correctly wraps the attributes of the target function. However, there is no equivalent test for `functools.singledispatchmethod`. There should be, as this is done separately in the `__get__` method of `functools.singledispatchmethod`; it is a different mechanism to `functools.singledispatch`.

Additionally, `test_abstractmethod_register` tests that the return value of `singledispatchmethod.__get__` wraps the target function's `__isabstractmethod__` attribute. However, the `__isabstractmethod__` property of the `singledispatchmethod` class is untested.
msg405626 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-03 16:12
New changeset 5a14929a6e4fab672e2f83a86773618e973b22a6 by Alex Waygood in branch 'main':
bpo-45678: Add ``functools.singledispatchmethod`` tests (GH-29328)
https://github.com/python/cpython/commit/5a14929a6e4fab672e2f83a86773618e973b22a6
msg405630 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-03 16:45
New changeset f1918385cccf3ef51d339dfa1f3654005508f307 by Miss Islington (bot) in branch '3.10':
bpo-45678: Add ``functools.singledispatchmethod`` tests (GH-29328) (GH-29390)
https://github.com/python/cpython/commit/f1918385cccf3ef51d339dfa1f3654005508f307
msg405652 - (view) Author: Alex Waygood (AlexWaygood) * (Python triager) Date: 2021-11-03 21:57
Backporting these tests to 3.9 revealed a bug in the 3.9 branch; PR 29394 is an attempt at fixing this bug.
msg405746 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-04 19:34
New changeset effb72fa0f6f8f8ec92687fc6a29d63bbdb7e98d by Alex Waygood in branch '3.9':
[3.9] bpo-45678: Fix `singledispatchmethod` `classmethod`/`staticmethod` bug (GH-29394)
https://github.com/python/cpython/commit/effb72fa0f6f8f8ec92687fc6a29d63bbdb7e98d
msg405748 - (view) Author: Alex Waygood (AlexWaygood) * (Python triager) Date: 2021-11-04 20:14
Yet more tests were added to the 3.9 branch in PR 29394 in order to test the bugfix. PR 29412 "forward-ports" these new tests into main (and 3.10, if they are backported).
msg405781 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-05 10:06
New changeset 32f55d1a5de66f9a86964fc0655d7a006a9d90b9 by Alex Waygood in branch 'main':
bpo-45678: Add more ``singledispatchmethod`` tests (GH-29412)
https://github.com/python/cpython/commit/32f55d1a5de66f9a86964fc0655d7a006a9d90b9
msg405803 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-05 15:27
New changeset bcb236c19e4ddf5ccf0fc45ab541eabf1f757a64 by Miss Islington (bot) in branch '3.10':
bpo-45678: Add more ``singledispatchmethod`` tests (GH-29412) (GH-29424)
https://github.com/python/cpython/commit/bcb236c19e4ddf5ccf0fc45ab541eabf1f757a64
msg405804 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-05 15:28
Thanks, Alex! ✨ 🍰 ✨
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89841
2021-11-05 15:28:00lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg405804

stage: patch review -> resolved
2021-11-05 15:27:30lukasz.langasetmessages: + msg405803
2021-11-05 10:06:28miss-islingtonsetpull_requests: + pull_request27677
2021-11-05 10:06:26lukasz.langasetmessages: + msg405781
2021-11-04 20:14:24AlexWaygoodsetmessages: + msg405748
2021-11-04 20:09:26AlexWaygoodsetpull_requests: + pull_request27664
2021-11-04 19:34:21lukasz.langasetmessages: + msg405746
2021-11-03 21:57:56AlexWaygoodsetmessages: + msg405652
2021-11-03 19:38:07AlexWaygoodsetcomponents: + Library (Lib)
title: `functools.singledispatchmethod` is missing tests -> `functools.singledispatchmethod` is missing tests (and is buggy in 3.9)
2021-11-03 19:32:37AlexWaygoodsetpull_requests: + pull_request27652
2021-11-03 16:45:39lukasz.langasetmessages: + msg405630
2021-11-03 16:12:17miss-islingtonsetpull_requests: + pull_request27649
2021-11-03 16:12:12miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request27648
2021-11-03 16:12:10lukasz.langasetmessages: + msg405626
2021-10-30 12:17:03AlexWaygoodsetcomponents: + Tests, - Library (Lib)
2021-10-30 12:16:05AlexWaygoodsetkeywords: + patch
stage: patch review
pull_requests: + pull_request27597
2021-10-30 12:10:31AlexWaygoodcreate