From: Serhiy Storchaka Date: Tue, 29 Nov 2016 18:49:14 +0000 (+0200) Subject: Issue #24469: Fixed memory leak caused by int subclasses without overridden X-Git-Tag: v2.7.13rc1~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13cc67946b7fc823433af0d1d81b7a3ce6007427;p=python Issue #24469: Fixed memory leak caused by int subclasses without overridden tp_free (e.g. C-inherited Cython classes). --- diff --git a/Misc/NEWS b/Misc/NEWS index 7d877a9a95..1215076a00 100644 --- 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. diff --git a/Objects/intobject.c b/Objects/intobject.c index 189413e102..0c5ea65ac0 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -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