aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-10-23 10:10:06 -0600
committerGitHub <noreply@github.com>2024-10-23 10:10:06 -0600
commit6f26d496d3c894970ee18a125e9100791ebc2b36 (patch)
tree62999ec30e17bb0334c82ae7137b10a6d64f3e48 /Python/pylifecycle.c
parentde0d5c6e2e12f24ade1ccc457afaf5fb2c650c64 (diff)
downloadcpython-6f26d496d3c894970ee18a125e9100791ebc2b36.tar.gz
cpython-6f26d496d3c894970ee18a125e9100791ebc2b36.zip
gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709)
They used to be shared, before 3.12. Returning to sharing them resolves a failure on Py_TRACE_REFS builds. Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index b8f424854ec..8f38fbedae9 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -674,6 +674,13 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
return status;
}
+ // This could be done in init_interpreter() (in pystate.c) if it
+ // didn't depend on interp->feature_flags being set already.
+ status = _PyObject_InitState(interp);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
+
// initialize the interp->obmalloc state. This must be done after
// the settings are loaded (so that feature_flags are set) but before
// any calls are made to obmalloc functions.
@@ -2297,6 +2304,13 @@ new_interpreter(PyThreadState **tstate_p,
goto error;
}
+ // This could be done in init_interpreter() (in pystate.c) if it
+ // didn't depend on interp->feature_flags being set already.
+ status = _PyObject_InitState(interp);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
+
// initialize the interp->obmalloc state. This must be done after
// the settings are loaded (so that feature_flags are set) but before
// any calls are made to obmalloc functions.