Repository navigation
gh-84644: Fix singledispatch annotation parsing - #143465
johnslavik wants to merge 108 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
0d72cec to
a5a79ad
Compare
|
@picnixz, could you please re-review? :) (The force-push was intentional; I know this is discouraged but I want to save noise, you can still follow what happened.) |
Documentation build overview
20 files changed ·
|
JelleZijlstra
left a comment
There was a problem hiding this comment.
I'm not sure it's valuable to specifically disallow return annotations if we still allow dispatching by annotations on wrong parameters.
We could deprecate cases when the chosen parameter isn't the same as in my new formula. @picnixz prefers to just document the limitation. And when the deprecation ends, we break custom descriptors that emulate static method behavior (which nowadays seems less of a risk than I originally thought, case looks extremely rare and it's a trivial fix). |
Yeah, it's not very valuable. But in other cases we can't really be sure something is wrong, and the check is cheap. +0; I'd merge it. |
|
New deprecations should not get backported. The docs improvements will need manual backports. |
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.