gh-94673: Add Per-Interpreter Storage for Static Builtin Types#95255
Merged
ericsnowcurrently merged 30 commits intoJul 26, 2022
Conversation
Member
Author
|
This was split out of #94995. |
Member
Author
|
For now consider |
This reverts commit 3f20f4a.
Member
Author
|
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 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_cacheto itnum_builtins_initializedfieldbuiltinsfield (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
PyTypeObjectisn't ideal and I may change it to store the index somewhere else.)