From ffe1b575a6a867da672d810fa94008e50d9af8b3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 12 Mar 2025 18:05:27 +0100 Subject: [PATCH] gh-111178: Fix PyRangeIter_Type deallocator Don't use PyObject_Free() as tp_dealloc to avoid an undefined behavior. Instead, use the default deallocator which just calls tp_free which is PyObject_Free(). --- Objects/rangeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 6d93d778dd7fb3..299dcd5232453d 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -910,7 +910,7 @@ PyTypeObject PyRangeIter_Type = { sizeof(_PyRangeIterObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ - (destructor)PyObject_Free, /* tp_dealloc */ + 0, /* tp_dealloc */ 0, /* tp_vectorcall_offset */ 0, /* tp_getattr */ 0, /* tp_setattr */