]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)
authorEric Snow <ericsnowcurrently@gmail.com>
Wed, 3 May 2023 03:30:03 +0000 (21:30 -0600)
committerGitHub <noreply@github.com>
Wed, 3 May 2023 03:30:03 +0000 (21:30 -0600)
commitde64e7561680fdc5358001e9488091e75d4174a3
treef89d99c8d18a03f9613056b4bd76486ebb68ec6b
parent872cbc613245db7a1fc5e6656ed0135d2e115f50
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.
Include/internal/pycore_typeobject.h
Modules/_abc.c
Modules/gcmodule.c
Objects/structseq.c
Objects/typeobject.c