}
if (match_self) {
// Easy. Copy the subject itself, and move on to kwargs.
- PyList_Append(attrs, subject);
+ if (PyList_Append(attrs, subject) < 0) {
+ goto fail;
+ }
}
else {
for (Py_ssize_t i = 0; i < nargs; i++) {
if (attr == NULL) {
goto fail;
}
- PyList_Append(attrs, attr);
+ if (PyList_Append(attrs, attr) < 0) {
+ Py_DECREF(attr);
+ goto fail;
+ }
Py_DECREF(attr);
}
}
if (attr == NULL) {
goto fail;
}
- PyList_Append(attrs, attr);
+ if (PyList_Append(attrs, attr) < 0) {
+ Py_DECREF(attr);
+ goto fail;
+ }
Py_DECREF(attr);
}
Py_SETREF(attrs, PyList_AsTuple(attrs));