]> granicus.if.org Git - python/commitdiff
Issue #24469: Fixed memory leak caused by int subclasses without overridden
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 29 Nov 2016 18:49:14 +0000 (20:49 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 29 Nov 2016 18:49:14 +0000 (20:49 +0200)
tp_free (e.g. C-inherited Cython classes).

Misc/NEWS
Objects/intobject.c

index 7d877a9a95bdbb75cef65bffa849d7055eab479f..1215076a007c060b5a2f3c2a92c34158a82c38d9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 2.7.13?
 Core and Builtins
 -----------------
 
+- Issue #24469: Fixed memory leak caused by int subclasses without overridden
+  tp_free (e.g. C-inherited Cython classes).
+
 - Issue #19398: Extra slash no longer added to sys.path components in case of
   empty compile-time PYTHONPATH components.
 
index 189413e102c60e37416b96dff37fb804384569ba..0c5ea65ac027b8c6e6506b7f6c66d176ace327c8 100644 (file)
@@ -139,13 +139,6 @@ int_dealloc(PyIntObject *v)
         Py_TYPE(v)->tp_free((PyObject *)v);
 }
 
-static void
-int_free(PyIntObject *v)
-{
-    Py_TYPE(v) = (struct _typeobject *)free_list;
-    free_list = v;
-}
-
 long
 PyInt_AsLong(register PyObject *op)
 {
@@ -1451,7 +1444,6 @@ PyTypeObject PyInt_Type = {
     0,                                          /* tp_init */
     0,                                          /* tp_alloc */
     int_new,                                    /* tp_new */
-    (freefunc)int_free,                         /* tp_free */
 };
 
 int