8000 gh-94673: Add Per-Interpreter Storage for Static Builtin Types by ericsnowcurrently · Pull Request #95255 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-94673: Add Per-Interpreter Storage for Static Builtin Types #95255

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

Merged
merged 30 commits into from
Jul 26, 2022
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7843524
Add PyInterpreterState.types.
ericsnowcurrently Jul 8, 2022
09fd0be
Add PyInterpreterState.types.num_builtins_initialized.
ericsnowcurrently Jul 9, 2022
afbde1a
Hard-code _Py_NUM_STATIC_BUILTIN_TYPES.
ericsnowcurrently Jul 18, 2022
f3aa649
Store per-interpreter state for static builtin types.
ericsnowcurrently Jul 19, 2022
9a1cc36
Export _PyStaticType_GetState().
ericsnowcurrently Jul 19, 2022
375b2d9
Move _PyStaticType_GetState() down next to _PyStaticType_InitBuiltin().
ericsnowcurrently Jul 19, 2022
b0b32a6
make it compile
kumaraditya303 Jul 19, 2022
eb05d9b
fix test_sys
kumaraditya303 Jul 19, 2022
f5ebd23
Reset tp_static_builtin_index only if a static builtin type.
ericsnowcurrently Jul 20, 2022
d94818b
Factor out get_static_builtin_index() and set_static_builtin_index().
ericsnowcurrently Jul 20, 2022
06799d5
Reset state->type later on.
ericsnowcurrently Jul 21, 2022
d78f10d
Add some asserts.
ericsnowcurrently Jul 21, 2022
44edc49
Decrement num_builtins_initialized.
ericsnowcurrently Jul 21, 2022
bc7fa26
Verify the per-interpreter type state has been cleared.
ericsnowcurrently Jul 22, 2022
3f20f4a
Add tp_static_builtin_index to the docs.
ericsnowcurrently Jul 25, 2022
9f7775d
Revert "Add tp_static_builtin_index to the docs."
ericsnowcurrently Jul 25, 2022
cf04c2c
Update tp_flags sooner in _PyStaticType_InitBuiltin().
ericsnowcurrently Jul 25, 2022
38427a0
Move the state/index-related helpers to the top.
ericsnowcurrently Jul 26, 2022
d313dbd
Add static_builtin_index_is_set() and static_builtin_index_clear().
ericsnowcurrently Jul 26, 2022
b4bbfcb
Hide the 1-based indexing behind the helper functions.
ericsnowcurrently Jul 26, 2022
1bd26c4
Move and edit a comment.
ericsnowcurrently Jul 26, 2022
652fcc6
Factor out static_builtin_state_init() and static_builtin_state_clear().
ericsnowcurrently Jul 26, 2022
d558a46
Un-initialize the type if PyType_Ready() fails.
ericsnowcurrently Jul 26, 2022
39a8fc7
Drop an empty line.
ericsnowcurrently Jul 26, 2022
6019eba
Move a comment.
ericsnowcurrently Jul 26, 2022
f2f10f0
static_builtin_type_state -> static_builtin_state (and factor out sta…
ericsnowcurrently Jul 26, 2022
cea5d34
Pass the type to static_builtin_state_get().
ericsnowcurrently Jul 26, 2022
4348e3f
Handle non-builtin and non-static types in _PyStaticType_GetState().
ericsnowcurrently Jul 26, 2022
1c8b0c3
Use static_builtin_index_is_set() in static_builtin_index_get().
ericsnowcurrently Jul 26, 2022
ae2d440
Restrict _PyStaticType_GetState() to static builtin types.
ericsnowcurrently Jul 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Un-initialize the type if PyType_Ready() fails.
  • Loading branch information
ericsnowcurrently committed Jul 26, 2022
commit d558a466094a121b9f950d7521ee666465112a7c
6 changes: 5 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6774,7 +6774,11 @@ _PyStaticType_InitBuiltin(PyTypeObject *self)

static_builtin_state_init(self);

return PyType_Ready(self);
int res = PyType_Ready(self);
if (res < 0) {
static_builtin_state_clear(self);
}
return res;
}


Expand Down
0