]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111178: Fix PyRangeIter_Type deallocator (#131162)
authorVictor Stinner <vstinner@python.org>
Thu, 13 Mar 2025 09:46:20 +0000 (10:46 +0100)
committerGitHub <noreply@github.com>
Thu, 13 Mar 2025 09:46:20 +0000 (10:46 +0100)
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

index 6d93d778dd7fb3fa624ceceefd1f10189cb14dc8..299dcd5232453d9690629c5ea6ff5e6a65d8cb4b 100644 (file)
@@ -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 */