Merge remote-tracking branch 'upstream/main' into lazy

This commit is contained in:
Pablo Galindo 2025-12-06 15:40:02 +00:00
commit db151a5192
869 changed files with 45727 additions and 16994 deletions

View file

@ -26,6 +26,7 @@
#include "pycore_runtime.h" // _Py_ID()
#include "pycore_runtime_init.h" // _PyRuntimeState_INIT
#include "pycore_setobject.h" // _PySet_NextEntry()
#include "pycore_stats.h" // _PyStats_InterpInit()
#include "pycore_sysmodule.h" // _PySys_ClearAttrString()
#include "pycore_traceback.h" // _Py_DumpTracebackThreads()
#include "pycore_typeobject.h" // _PyTypes_InitTypes()
@ -656,6 +657,14 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
return status;
}
#ifdef Py_STATS
// initialize pystats. This must be done after the settings are loaded.
status = _PyStats_InterpInit(interp);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
#endif
// 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.
@ -2484,6 +2493,14 @@ new_interpreter(PyThreadState **tstate_p,
return status;
}
#ifdef Py_STATS
// initialize pystats. This must be done after the settings are loaded.
status = _PyStats_InterpInit(interp);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
#endif
// 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.
@ -2641,7 +2658,7 @@ finalize_subinterpreters(void)
(void)PyErr_WarnEx(
PyExc_RuntimeWarning,
"remaining subinterpreters; "
"destroy them with _interpreters.destroy()",
"close them with Interpreter.close()",
0);
/* Swap out the current tstate, which we know must belong