From: Serhiy Storchaka Date: Wed, 13 Apr 2016 12:27:33 +0000 (+0300) Subject: Issue #26718: super.__init__ no longer leaks memory if called multiple times. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ec6464008c3a04e6486541c4f031bdf0af28cf3;p=python Issue #26718: super.__init__ no longer leaks memory if called multiple times. NOTE: A direct call of super.__init__ is not endorsed! --- diff --git a/Misc/NEWS b/Misc/NEWS index ed6e8bc449..cebb5a5aec 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 2.7.12? Core and Builtins ----------------- +- Issue #26718: super.__init__ no longer leaks memory if called multiple times. + NOTE: A direct call of super.__init__ is not endorsed! + - Issue #13410: Fixed a bug in PyUnicode_Format where it failed to properly ignore errors from a __int__() method. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index b186623fe7..70156675ad 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6741,9 +6741,9 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds) Py_INCREF(obj); } Py_INCREF(type); - su->type = type; - su->obj = obj; - su->obj_type = obj_type; + Py_XSETREF(su->type, type); + Py_XSETREF(su->obj, obj); + Py_XSETREF(su->obj_type, obj_type); return 0; }