summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-03-21 17:46:09 (GMT)
committerGitHub <noreply@github.com>2023-03-21 17:46:09 (GMT)
commit743687434c5baf01c266320b34c7a828726702a6 (patch)
tree6d26f4fcb5aaa2b606b433aecad939e9f36734f9 /Python/pylifecycle.c
parent4bb1dd3c5c14338c9d9cea5988431c858b3b76e0 (diff)
downloadcpython-743687434c5baf01c266320b34c7a828726702a6.zip
cpython-743687434c5baf01c266320b34c7a828726702a6.tar.gz
cpython-743687434c5baf01c266320b34c7a828726702a6.tar.bz2
gh-102304: Move the Total Refcount to PyInterpreterState (gh-102545)
Moving it valuable with a per-interpreter GIL. However, it is also useful without one, since it allows us to identify refleaks within a single interpreter or where references are escaping an interpreter. This becomes more important as we move the obmalloc state to PyInterpreterState. https://github.com/python/cpython/issues/102304
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 8b58a14..0d546d5 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -802,6 +802,11 @@ pycore_interp_init(PyThreadState *tstate)
PyStatus status;
PyObject *sysmod = NULL;
+ // This is a temporary fix until we have immortal objects.
+ // (See _PyType_InitCache() in typeobject.c.)
+ extern void _PyType_FixCacheRefcounts(void);
+ _PyType_FixCacheRefcounts();
+
// Create singletons before the first PyType_Ready() call, since
// PyType_Ready() uses singletons like the Unicode empty string (tp_doc)
// and the empty tuple singletons (tp_bases).