-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-84644: Fix singledispatch annotation parsing #143465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
gh-84644: Fix singledispatch annotation parsing #143465
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Removed _dispatchmethod=False from register property, because it was an incorrect assumption.
|
I was asked to filter out tests that were helpful at the time of writing this code with detecting backward compatibility problems, but already pass on main. If we're interested in increasing coverage, they'll be recoverable from a commit that removes them. I'll do it in the next few days. In the meantime, the implementation on its own can be reviewed. |
JelleZijlstra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me!
Done now. Ready for a proper review. |
A very practical but more general approach than GH-140255 to fixing annotation parsing in
functools.singledispatchandfunctools.singledispatchmethod.Aims to fix issues GH-84644 and GH-130827.
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.