-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-94673: Add Per-Interpreter Storage for Static Builtin Types #95255
gh-94673: Add Per-Interpreter Storage for Static Builtin Types #95255
Conversation
This was split out of #94995. |
For now consider |
This reverts commit 3f20f4a.
I'm going to leave |
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 9f7775d 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
…tic_builtin_state_get())
fe54d39
to
cea5d34
Compare
This is the last precursor to storing
tp_subclasses
(andtp_weaklist
) on the interpreter state for static builtin types.Here we add per-type storage on
PyInterpreterState
, but only for the static builtin types. This involves the following:PyInterpreterState.type_cache
to itnum_builtins_initialized
fieldbuiltins
field (a static array big enough for all the static builtin types)_PyStaticType_GetState()
to look up a static builtin type's statePyTypeObject.tp_static_builtin_index
(to hold the type's index intoPyInterpreterState.types.builtins
)(Adding an extra field to
PyTypeObject
isn't ideal and I may change it to store the index somewhere else.)