FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Draft: gh-139103: Use _PyObject_GetMethodStackRef for slot_tp_new by eendebakpt · Pull Request #141603 · python/cpython · GitHub

/ cpython Public

Draft: gh-139103: Use _PyObject_GetMethodStackRef for slot_tp_new - #141603

Closed
eendebakpt wants to merge 9 commits into
python:mainfrom
eendebakpt:namedtuple_stackref
Closed

Draft: gh-139103: Use _PyObject_GetMethodStackRef for slot_tp_new#141603
eendebakpt wants to merge 9 commits into
python:mainfrom
eendebakpt:namedtuple_stackref

Conversation

eendebakpt commented Nov 15, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Use _PyObject_GetMethodStackRef for slot_tp_new to avoid refcount contention in namedtuple.

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

Comment thread Objects/typeobject.c Outdated
Comment thread Objects/typeobject.c Outdated

Copy link
Copy Markdown
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.

eendebakpt marked this pull request as draft February 23, 2026 10:21
eendebakpt closed this Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL