Skip to content

Conversation

@eendebakpt
Copy link
Contributor

@eendebakpt eendebakpt commented Nov 15, 2025

Use _PyObject_GetMethodStackRef for slot_tp_new to avoid refcount contention in namedtuple.

Marked draft: the free-threading bottleneck is not yet resolved

@colesbury
Copy link
Contributor

@eendebakpt: _PyObject_GetMethodStackRef is not going to be efficient here. It's only specialized if the passed in object's type has a tp->tp_getattro of PyObject_GenericGetAttr. In this case we are getting the __new__ function on a type instance. Typically a type's type is PyType_Type and that has tp_getattro of _Py_type_getattro.

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