mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)
his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses. Those three fields are effectively const for builtin static types (unlike tp_subclasses). In theory we only need to make their values immortal, along with their contents. However, that isn't such a simple proposition. (See gh-103823.) In the meantime the simplest solution is to move the fields into the interpreter. One alternative is to statically allocate the values, but that's its own can of worms.
This commit is contained in:
parent
872cbc6132
commit
de64e75616
5 changed files with 185 additions and 86 deletions
|
|
@ -44,6 +44,13 @@ struct type_cache {
|
|||
|
||||
typedef struct {
|
||||
PyTypeObject *type;
|
||||
int readying;
|
||||
int ready;
|
||||
// XXX tp_dict, tp_bases, and tp_mro can probably be statically
|
||||
// allocated, instead of dynamically and stored on the interpreter.
|
||||
PyObject *tp_dict;
|
||||
PyObject *tp_bases;
|
||||
PyObject *tp_mro;
|
||||
PyObject *tp_subclasses;
|
||||
/* We never clean up weakrefs for static builtin types since
|
||||
they will effectively never get triggered. However, there
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue