Skip to content

Conversation

@johnslavik
Copy link
Member

@johnslavik johnslavik commented Jan 6, 2026

A very practical but more general approach than GH-140255 to fixing annotation parsing in functools.singledispatch and functools.singledispatchmethod.

Aims to fix issues GH-84644 and GH-130827.

It can be broken if one uses a user-defined alternative implementation of staticmethod or something analogous.
Will break incorrect but working registrees. I haven't investigated stripping Annotated typeforms 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.

@johnslavik

This comment was marked as resolved.

@johnslavik johnslavik marked this pull request as draft January 8, 2026 00:42
@johnslavik
Copy link
Member Author

johnslavik commented Jan 8, 2026

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.

Copy link
Member

@JelleZijlstra JelleZijlstra left a 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!

@johnslavik
Copy link
Member Author

I'll do it in the next few days.

Done now.

Ready for a proper review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants