From 42494bf5a20ef271d3a92d65249f408a1dca97ff Mon Sep 17 00:00:00 2001 From: xFrednet Date: Thu, 26 Mar 2026 15:21:42 +0100 Subject: [PATCH 1/2] Remove _PyRegion_SignalDealloc --- Objects/object.c | 1 - Objects/typeobject.c | 1 - Python/ceval.c | 2 -- 3 files changed, 4 deletions(-) diff --git a/Objects/object.c b/Objects/object.c index bbe557d6e627064..53502a0785b2828 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -26,7 +26,6 @@ #include "pycore_pyerrors.h" // _PyErr_Occurred() #include "pycore_pymem.h" // _PyMem_IsPtrFreed() #include "pycore_pystate.h" // _PyThreadState_GET() -#include "pycore_region.h" // _PyRegion_SignalDealloc #include "pycore_symtable.h" // PySTEntry_Type #include "pycore_template.h" // _PyTemplate_Type _PyTemplateIter_Type #include "pycore_tuple.h" // _PyTuple_DebugMallocStats() diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 60edb30041a5e62..b471877fb365974 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -17,7 +17,6 @@ #include "pycore_pyatomic_ft_wrappers.h" #include "pycore_pyerrors.h" // _PyErr_Occurred() #include "pycore_pystate.h" // _PyThreadState_GET() -#include "pycore_region.h" // _PyRegion_SignalDealloc() #include "pycore_symtable.h" // _Py_Mangle() #include "pycore_typeobject.h" // struct type_cache #include "pycore_unicodeobject.h" // _PyUnicode_Copy diff --git a/Python/ceval.c b/Python/ceval.c index 6a8eb45a84db3ed..a1e9b933dc99721 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -34,7 +34,6 @@ #include "pycore_pyerrors.h" // _PyErr_GetRaisedException() #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_range.h" // _PyRangeIterObject -#include "pycore_region.h" // _PyRegion_SignalDealloc #include "pycore_setobject.h" // _PySet_Update() #include "pycore_sliceobject.h" // _PyBuildSlice_ConsumeRefs #include "pycore_sysmodule.h" // _PySys_GetOptionalAttrString() @@ -102,7 +101,6 @@ if ((--op->ob_refcnt) == 0) { \ _PyReftracerTrack(op, PyRefTracer_DESTROY); \ destructor dealloc = Py_TYPE(op)->tp_dealloc; \ - _PyRegion_SignalDealloc(op); \ (*dealloc)(op); \ } \ } while (0) From 200de9cfce8d2bca3287a0591d00275100446739 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Mon, 30 Mar 2026 17:34:50 +0200 Subject: [PATCH 2/2] Clear region for recycled being objects --- Modules/_asynciomodule.c | 1 + Objects/tupleobject.c | 1 + 2 files changed, 2 insertions(+) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 99408e60721c602..0ae3a1ddb0dae40 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1839,6 +1839,7 @@ FutureIter_dealloc(PyObject *it) PyObject_GC_UnTrack(it); tp->tp_clear(it); + PyRegion_RecycleObject(it); if (!_Py_FREELIST_PUSH(futureiters, it, Py_futureiters_MAXFREELIST)) { PyObject_GC_Del(it); Py_DECREF(tp); diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 03b3b4c2fd7f36f..f95eb14b2883885 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -1231,6 +1231,7 @@ maybe_freelist_push(PyTupleObject *op) } Py_ssize_t index = Py_SIZE(op) - 1; if (index < PyTuple_MAXSAVESIZE) { + PyRegion_RecycleObject(op); return _Py_FREELIST_PUSH(tuples[index], op, Py_tuple_MAXFREELIST); } return 0;