diff options
author | Victor Stinner <vstinner@python.org> | 2020-12-26 01:45:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-26 01:45:43 +0100 |
commit | 41010184880151d6ae02a226dbacc796e5c90d11 (patch) | |
tree | 5d87ed2b4392de3d7063b59f03d955b04f8b0eec /Python | |
parent | Add convolve() to the itertools recipes (GH-23928) (diff) | |
download | cpython-41010184880151d6ae02a226dbacc796e5c90d11.tar.gz cpython-41010184880151d6ae02a226dbacc796e5c90d11.tar.bz2 cpython-41010184880151d6ae02a226dbacc796e5c90d11.zip |
bpo-42745: Make the type cache per-interpreter (GH-23947)
Make the type attribute lookup cache per-interpreter.
Add private _PyType_InitCache() function, called by PyInterpreterState_New().
Continue to share next_version_tag between interpreters, since static
types are still shared by interpreters.
Remove MCACHE macro: the cache is no longer disabled if the
EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pylifecycle.c | 2 | ||||
-rw-r--r-- | Python/pystate.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 8d744c7bfd4..c3c1aa22e94 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1750,7 +1750,7 @@ Py_FinalizeEx(void) _PyImport_Fini(); /* Cleanup typeobject.c's internal caches. */ - _PyType_Fini(); + _PyType_Fini(tstate); /* unload faulthandler module */ _PyFaulthandler_Fini(); diff --git a/Python/pystate.c b/Python/pystate.c index 231144b0828..c791b239993 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -4,6 +4,7 @@ #include "Python.h" #include "pycore_ceval.h" #include "pycore_initconfig.h" +#include "pycore_object.h" // _PyType_InitCache() #include "pycore_pyerrors.h" #include "pycore_pylifecycle.h" #include "pycore_pymem.h" // _PyMem_SetDefaultAllocator() @@ -223,6 +224,7 @@ PyInterpreterState_New(void) _PyGC_InitState(&interp->gc); PyConfig_InitPythonConfig(&interp->config); + _PyType_InitCache(interp); interp->eval_frame = _PyEval_EvalFrameDefault; #ifdef HAVE_DLOPEN |