GH-127705: Use _PyStackRefs in the default build. (GH-127875)

This commit is contained in:
Mark Shannon 2025-03-10 14:06:56 +00:00 committed by GitHub
parent 7cc99a54b7
commit 2bef8ea8ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 688 additions and 254 deletions

View file

@ -1,6 +1,7 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_stackref.h"
#if !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG)
@ -175,8 +176,16 @@ _Py_stackref_report_leaks(PyInterpreterState *interp)
int leak = 0;
_Py_hashtable_foreach(interp->open_stackrefs_table, report_leak, &leak);
if (leak) {
fflush(stdout);
Py_FatalError("Stackrefs leaked.");
}
}
void
PyStackRef_CLOSE_SPECIALIZED(_PyStackRef ref, destructor destruct)
{
PyObject *obj = _Py_stackref_close(ref);
_Py_DECREF_SPECIALIZED(obj, destruct);
}
#endif