summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-08-07 19:14:56 (GMT)
committerGitHub <noreply@github.com>2023-08-07 19:14:56 (GMT)
commit430632d6f710c99879c5d1736f3b40ea09b11c4d (patch)
tree5c170b5a94186d7703e353837fbfcc1b2b8ec47b /Python
parent16c9415fba4972743f1944ebc44946e475e68bc4 (diff)
downloadcpython-430632d6f710c99879c5d1736f3b40ea09b11c4d.zip
cpython-430632d6f710c99879c5d1736f3b40ea09b11c4d.tar.gz
cpython-430632d6f710c99879c5d1736f3b40ea09b11c4d.tar.bz2
gh-107630: Initialize Each Interpreter's refchain Properly (gh-107733)
This finishes fixing the crashes in Py_TRACE_REFS builds. We missed this part in gh-107567.
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c2
-rw-r--r--Python/pystate.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 7a17f92..0de3abf 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2075,6 +2075,8 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config)
}
has_gil = 1;
+ /* No objects have been created yet. */
+
status = pycore_interp_init(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto error;
diff --git a/Python/pystate.c b/Python/pystate.c
index a1864cc..3a05cb0 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -674,6 +674,7 @@ init_interpreter(PyInterpreterState *interp,
_obmalloc_pools_INIT(interp->obmalloc.pools);
memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp));
}
+ _PyObject_InitState(interp);
_PyEval_InitState(interp, pending_lock);
_PyGC_InitState(&interp->gc);