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>
This commit is contained in:
Eric Snow 2024-10-23 10:10:06 -06:00 committed by GitHub
parent de0d5c6e2e
commit 6f26d496d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 99 additions and 61 deletions

View file

@ -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.