summaryrefslogtreecommitdiffstats
path: root/Python/stackrefs.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-03-10 14:06:56 (GMT)
committerGitHub <noreply@github.com>2025-03-10 14:06:56 (GMT)
commit2bef8ea8ea045d20394f0daec7a5c5b1046a4e22 (patch)
treeeb4ee444fd0d58b788304c46839807475ea133ac /Python/stackrefs.c
parent7cc99a54b755cc7cc0b3680fde7834cf612d4fbc (diff)
downloadcpython-2bef8ea8ea045d20394f0daec7a5c5b1046a4e22.zip
cpython-2bef8ea8ea045d20394f0daec7a5c5b1046a4e22.tar.gz
cpython-2bef8ea8ea045d20394f0daec7a5c5b1046a4e22.tar.bz2
GH-127705: Use `_PyStackRef`s in the default build. (GH-127875)
Diffstat (limited to 'Python/stackrefs.c')
-rw-r--r--Python/stackrefs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/stackrefs.c b/Python/stackrefs.c
index 2e889b1..a7693ba 100644
--- a/Python/stackrefs.c
+++ b/Python/stackrefs.c
@@ -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