summaryrefslogtreecommitdiff
path: root/Include/cpython
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-07-26 17:26:43 -0600
committerGitHub <noreply@github.com>2022-07-26 17:26:43 -0600
commit47e75a0025529fa538bc24d55b27ae4823d3df9d (patch)
tree9b95e72bfa40ba54e1da3dd216f297a6e870984d /Include/cpython
parent7ac5bb3e6a1cf780aea8164fdba09db993a21d6f (diff)
downloadcpython-git-47e75a0025529fa538bc24d55b27ae4823d3df9d.tar.gz
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.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 614d6c18ee..1ca1a576fb 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -227,6 +227,7 @@ struct _typeobject {
destructor tp_finalize;
vectorcallfunc tp_vectorcall;
+ size_t tp_static_builtin_index; /* 0 means "not initialized" */
};
/* This struct is used by the specializer