From 13cc67946b7fc823433af0d1d81b7a3ce6007427 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 29 Nov 2016 20:49:14 +0200 Subject: [PATCH] Issue #24469: Fixed memory leak caused by int subclasses without overridden tp_free (e.g. C-inherited Cython classes). --- Misc/NEWS | 3 +++ Objects/intobject.c | 8 -------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 7d877a9a95bd..1215076a007c 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 189413e102c6..0c5ea65ac027 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 -- 2.47.3