]> granicus.if.org Git - python/commitdiff
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 13 Apr 2016 12:27:33 +0000 (15:27 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 13 Apr 2016 12:27:33 +0000 (15:27 +0300)
NOTE: A direct call of super.__init__ is not endorsed!

Misc/NEWS
Objects/typeobject.c

index ed6e8bc449541e5f6d2f87b417484507b1c1746c..cebb5a5aecdf188dc0f5be620283610a1acbffa4 100644 (file)
--- 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.
 
index b186623fe78cced075bf242265ffa4663e1ec52e..70156675ad77b6de55779189c045e18ca96390db 100644 (file)
@@ -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;
 }