https://github.com/python/cpython/commit/0c6c52f49605f757c4a125ca195a2123bd930b93
commit: 0c6c52f49605f757c4a125ca195a2123bd930b93
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-03-13T10:46:20+01:00
summary:

gh-111178: Fix PyRangeIter_Type deallocator (#131162)

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().

files:
M Objects/rangeobject.c

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 */

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to