Patch from Xiang Zhang.
This commit is contained in:
Benjamin Peterson 2016-07-06 23:28:19 -07:00
commit c13d85bf8d
1 changed files with 9 additions and 3 deletions

View File

@ -4522,8 +4522,10 @@ add_members(PyTypeObject *type, PyMemberDef *memb)
descr = PyDescr_NewMember(type, memb);
if (descr == NULL)
return -1;
if (PyDict_SetItemString(dict, memb->name, descr) < 0)
if (PyDict_SetItemString(dict, memb->name, descr) < 0) {
Py_DECREF(descr);
return -1;
}
Py_DECREF(descr);
}
return 0;
@ -4542,8 +4544,10 @@ add_getset(PyTypeObject *type, PyGetSetDef *gsp)
if (descr == NULL)
return -1;
if (PyDict_SetItemString(dict, gsp->name, descr) < 0)
if (PyDict_SetItemString(dict, gsp->name, descr) < 0) {
Py_DECREF(descr);
return -1;
}
Py_DECREF(descr);
}
return 0;
@ -7023,8 +7027,10 @@ add_operators(PyTypeObject *type)
descr = PyDescr_NewWrapper(type, p, *ptr);
if (descr == NULL)
return -1;
if (PyDict_SetItem(dict, p->name_strobj, descr) < 0)
if (PyDict_SetItem(dict, p->name_strobj, descr) < 0) {
Py_DECREF(descr);
return -1;
}
Py_DECREF(descr);
}
}