Skip to content

Commit 9ec6464

Browse files
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
NOTE: A direct call of super.__init__ is not endorsed!
1 parent f1023ba commit 9ec6464

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎Misc/NEWS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 2.7.12?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #26718: super.__init__ no longer leaks memory if called multiple times.
14+
NOTE: A direct call of super.__init__ is not endorsed!
15+
1316
- Issue #13410: Fixed a bug in PyUnicode_Format where it failed to properly
1417
ignore errors from a __int__() method.
1518

‎Objects/typeobject.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6741,9 +6741,9 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
67416741
Py_INCREF(obj);
67426742
}
67436743
Py_INCREF(type);
6744-
su->type = type;
6745-
su->obj = obj;
6746-
su->obj_type = obj_type;
6744+
Py_XSETREF(su->type, type);
6745+
Py_XSETREF(su->obj, obj);
6746+
Py_XSETREF(su->obj_type, obj_type);
67476747
return 0;
67486748
}
67496749

0 commit comments

Comments
 (0)