Skip to content

gh-148608: Unbind classmethods in LOAD_ATTR_CLASS#148610

Open
Fidget-Spinner wants to merge 5 commits intopython:mainfrom
Fidget-Spinner:unbound_classmethod
Open

gh-148608: Unbind classmethods in LOAD_ATTR_CLASS#148610
Fidget-Spinner wants to merge 5 commits intopython:mainfrom
Fidget-Spinner:unbound_classmethod

Conversation

@Fidget-Spinner
Copy link
Copy Markdown
Member

@Fidget-Spinner Fidget-Spinner commented Apr 15, 2026

CALL_BOUND_METHOD_EXACT_ARGS now becomes CALL_PY_EXACT_ARGS for cls.classmethod() calls.

@Fidget-Spinner
Copy link
Copy Markdown
Member Author

Hmm, I think I'm going to skip news as this change (in theory) should not be observable at all from the user's perspective, even on the perf side on the normal interpreter.

A better way would be to load the method directly via _PyType_Lookup if we determine it's a type. However, that requires a lot of duplicated code and factoring of the _PyObject_GetMethod function. It's also a lot harder to get right. However, a working implementation of that would significantly improve FT scaling for cls.classmethod. I'm going to leave that to someone else, as I'm scared of breaking lookups in Python.

@Fidget-Spinner
Copy link
Copy Markdown
Member Author

I think I have a better solution of handling this at specialization time. Let me investigate.

@Fidget-Spinner Fidget-Spinner changed the title gh-148608: Unbind methods at _LOAD_ATTR time eagerly for better specialization gh-148608: Unbind classmethods in LOAD_ATTR_CLASS Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants