]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-94673: Add Per-Interpreter Storage for Static Builtin Types (#95255)
authorEric Snow <ericsnowcurrently@gmail.com>
Tue, 26 Jul 2022 23:26:43 +0000 (17:26 -0600)
committerGitHub <noreply@github.com>
Tue, 26 Jul 2022 23:26:43 +0000 (17:26 -0600)
commit47e75a0025529fa538bc24d55b27ae4823d3df9d
tree9b95e72bfa40ba54e1da3dd216f297a6e870984d
parent7ac5bb3e6a1cf780aea8164fdba09db993a21d6f
gh-94673: Add Per-Interpreter Storage for Static Builtin Types (#95255)

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
* (temporarily) add PyTypeObject.tp_static_builtin_index (to hold the type's index into PyInterpreterState.types.builtins)

We will be eliminating tp_static_builtin_index in a later change.
Include/cpython/object.h
Include/internal/pycore_interp.h
Include/internal/pycore_typeobject.h
Lib/test/test_sys.py
Objects/typeobject.c