Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18e7083

Browse files
committed
SF bug 681122: Built-in function dir() causes refcount leak in baseclasses.
merge_class_dict(): This was missing a decref. Bugfix candidate.
1 parent 6ee0480 commit 18e7083

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Objects/object.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,12 +1656,15 @@ merge_class_dict(PyObject* dict, PyObject* aclass)
16561656
PyErr_Clear();
16571657
else {
16581658
for (i = 0; i < n; i++) {
1659+
int status;
16591660
PyObject *base = PySequence_GetItem(bases, i);
16601661
if (base == NULL) {
16611662
Py_DECREF(bases);
16621663
return -1;
16631664
}
1664-
if (merge_class_dict(dict, base) < 0) {
1665+
status = merge_class_dict(dict, base);
1666+
Py_DECREF(base);
1667+
if (status < 0) {
16651668
Py_DECREF(bases);
16661669
return -1;
16671670
}

0 commit comments

Comments
 (0)