[Python-checkins] cpython (2.7): Issue #24469: Fixed memory leak caused by int subclasses without overridden

serhiy.storchaka python-checkins at python.org
Tue Nov 29 13:49:31 EST 2016


https://hg.python.org/cpython/rev/fd0842f34602
changeset:   105396:fd0842f34602
branch:      2.7
parent:      105371:59bd48afa1bc
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Nov 29 20:49:14 2016 +0200
summary:
  Issue #24469: Fixed memory leak caused by int subclasses without overridden
tp_free (e.g. C-inherited Cython classes).

files:
  Misc/NEWS           |  3 +++
  Objects/intobject.c |  8 --------
  2 files changed, 3 insertions(+), 8 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 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.
 
diff --git a/Objects/intobject.c b/Objects/intobject.c
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -139,13 +139,6 @@
         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 @@
     0,                                          /* tp_init */
     0,                                          /* tp_alloc */
     int_new,                                    /* tp_new */
-    (freefunc)int_free,                         /* tp_free */
 };
 
 int

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list