gh-84644: Fix singledispatch annotation parsing#143465
Open
johnslavik wants to merge 102 commits intopython:mainfrom
Open
gh-84644: Fix singledispatch annotation parsing#143465johnslavik wants to merge 102 commits intopython:mainfrom
johnslavik wants to merge 102 commits intopython:mainfrom
Conversation
johnslavik
commented
Jan 6, 2026
This comment was marked as resolved.
This comment was marked as resolved.
johnslavik
commented
Jan 6, 2026
johnslavik
commented
Jan 6, 2026
johnslavik
commented
Jan 22, 2026
Member
Author
|
Hold on, I'll also think about the prospect of fixing GH-143535 separately. This could be simplified with that other issue in mind. |
Member
Author
picnixz
reviewed
Mar 1, 2026
Misc/NEWS.d/next/Library/2026-01-06-09-13-53.gh-issue-84644.V_cYP3.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Library/2026-01-06-09-13-53.gh-issue-84644.V_cYP3.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Library/2026-01-06-09-13-53.gh-issue-84644.V_cYP3.rst
Outdated
Show resolved
Hide resolved
Member
|
I also think it'd be better as a new feature so that it pairs well with what we already shipped. Considering it relies on annotationlib, it wouldn't be possible to backport it to 3.13 either so I'd prefer keeping it in 3.15 only. |
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Hugo can choose to delete it anything
Member
Author
|
Thanks for the careful review, @picnixz :) I've also added a "What's New" entry. Do you think this looks good now? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A very practical but more general approach than GH-140255 to fixing annotation parsing in
functools.singledispatchandfunctools.singledispatchmethod.Fixes issues GH-84644, GH-130827, and GH-143886.
It can be broken if one uses a user-defined alternative implementation of
staticmethodor something analogous.Will break incorrect but working registrees.
I haven't investigated strippingAnnotatedtypeforms yet.Consulting a test which fails with this fix at https://github.com/python/cpython/pull/130309/changes#r2663516538 -- I think that the test is wrong.