From 9ec6464008c3a04e6486541c4f031bdf0af28cf3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 13 Apr 2016 15:27:33 +0300 Subject: Issue #26718: super.__init__ no longer leaks memory if called multiple times. NOTE: A direct call of super.__init__ is not endorsed! --- Misc/NEWS | 3 +++ Objects/typeobject.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index ed6e8bc..cebb5a5 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 b186623..7015667 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; } -- cgit v0.12