/* make sure self->children can hold the given number of extra
elements. set an exception and return -1 if allocation failed */
- if (!self->extra)
- create_extra(self, NULL);
+ if (!self->extra) {
+ if (create_extra(self, NULL) < 0)
+ return -1;
+ }
size = self->extra->length + extra;
&Element_Type, &element))
return NULL;
- if (!self->extra)
- create_extra(self, NULL);
+ if (!self->extra) {
+ if (create_extra(self, NULL) < 0)
+ return NULL;
+ }
if (index < 0) {
index += self->extra->length;
if (!PyArg_ParseTuple(args, "OO:set", &key, &value))
return NULL;
- if (!self->extra)
- create_extra(self, NULL);
+ if (!self->extra) {
+ if (create_extra(self, NULL) < 0)
+ return NULL;
+ }
attrib = element_get_attrib(self);
if (!attrib)
PyObject* recycle = NULL;
PyObject* seq = NULL;
- if (!self->extra)
- create_extra(self, NULL);
+ if (!self->extra) {
+ if (create_extra(self, NULL) < 0)
+ return -1;
+ }
if (PySlice_GetIndicesEx(item,
self->extra->length,
res = element_get_tail(self);
} else if (strcmp(name, "attrib") == 0) {
PyErr_Clear();
- if (!self->extra)
- create_extra(self, NULL);
+ if (!self->extra) {
+ if (create_extra(self, NULL) < 0)
+ return NULL;
+ }
res = element_get_attrib(self);
}
self->tail = value;
Py_INCREF(self->tail);
} else if (strcmp(name, "attrib") == 0) {
- if (!self->extra)
- create_extra(self, NULL);
+ if (!self->extra) {
+ if (create_extra(self, NULL) < 0)
+ return -1;
+ }
Py_DECREF(self->extra->attrib);
self->extra->attrib = value;
Py_INCREF(self->extra->attrib);