GeezerVison is showing github.com — gh-94673: Add Per-Interpreter Storage for Static Builtin Types by ericsnowcurrently · Pull Request #95255 · python/cpython
Conversation
This is the last precursor to storing tp_subclasses (and tp_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:
- add `PyInterpreterState.types'
- move
PyInterpreterState.type_cache to it
- add a
num_builtins_initialized field
- add a
builtins field (a static array big enough for all the static builtin types)
- add
_PyStaticType_GetState() to look up a static builtin type's state
- add
PyTypeObject.tp_static_builtin_index (to hold the type's index into PyInterpreterState.types.builtins)
(Adding an extra field to PyTypeObject isn't ideal and I may change it to store the index somewhere else.)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
For now consider PyTypeObject.tp_static_builtin_index a temporary addition. I'd like to drop it once we start storing tp_subclasses on PyInterpreterState for static builtin types. At that point we can use tp_subclasses to store the index.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I'm going to leave tp_static_builtin_index undocumented since it is temporary. If that changes then we'll document it.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…tic_builtin_state_get())
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|