mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
7ac5bb3e6a
commit
47e75a0025
5 changed files with 125 additions and 7 deletions
|
@ -1507,7 +1507,7 @@ class SizeofTest(unittest.TestCase):
|
|||
check((1,2,3), vsize('') + 3*self.P)
|
||||
# type
|
||||
# static type: PyTypeObject
|
||||
fmt = 'P2nPI13Pl4Pn9Pn12PIP'
|
||||
fmt = 'P2nPI13Pl4Pn9Pn12PIPI'
|
||||
s = vsize('2P' + fmt)
|
||||
check(int, s)
|
||||
# class
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue