Mercurial > cpython-lru_cache-weakref
diff Modules/_elementtree.c @ 87505:e02bf9919f01
Cosmetic fixes
| author | Eli Bendersky <eliben@gmail.com> |
|---|---|
| date | Sun, 24 Nov 2013 06:55:04 -0800 |
| parents | 28f71af02b69 |
| children | 2b2925c08a6c |
line wrap: on
line diff
--- a/Modules/_elementtree.c Sun Nov 24 15:01:39 2013 +0100 +++ b/Modules/_elementtree.c Sun Nov 24 06:55:04 2013 -0800 @@ -567,8 +567,9 @@ PyObject* attrib = NULL; if (!PyArg_ParseTuple(args, "O!O|O!:SubElement", &Element_Type, &parent, &tag, - &PyDict_Type, &attrib)) + &PyDict_Type, &attrib)) { return NULL; + } if (attrib) { /* attrib passed as positional arg */ @@ -652,7 +653,6 @@ } /* -------------------------------------------------------------------- */ -/* methods (in alphabetical order) */ static PyObject* element_append(ElementObject* self, PyObject* args) @@ -696,8 +696,7 @@ return NULL; element = (ElementObject*) create_new_element( - self->tag, (self->extra) ? self->extra->attrib : Py_None - ); + self->tag, (self->extra) ? self->extra->attrib : Py_None); if (!element) return NULL; @@ -710,7 +709,6 @@ Py_INCREF(JOIN_OBJ(element->tail)); if (self->extra) { - if (element_resize(element, self->extra->length) < 0) { Py_DECREF(element); return NULL; @@ -722,7 +720,6 @@ } element->extra->length = self->extra->length; - } return (PyObject*) element; @@ -779,7 +776,6 @@ element->tail = JOIN_SET(tail, JOIN_GET(self->tail)); if (self->extra) { - if (element_resize(element, self->extra->length) < 0) goto error; @@ -793,7 +789,6 @@ } element->extra->length = self->extra->length; - } /* add object to memo dictionary (so deepcopy won't visit it again) */ @@ -1141,8 +1136,8 @@ for (i = 0; i < self->extra->length; i++) { ElementObject* item = (ElementObject*) self->extra->children[i]; - if (Element_CheckExact(item) && (PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) { - + if (Element_CheckExact(item) && + (PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) { PyObject* text = element_get_text(item); if (text == Py_None) return PyUnicode_New(0, 0); @@ -1207,12 +1202,12 @@ elementtreestate *st = ET_STATE_GLOBAL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:iterfind", kwlist, - &tag, &namespaces)) + &tag, &namespaces)) { return NULL; + } return _PyObject_CallMethodId( - st->elementpath_obj, &PyId_iterfind, "OOO", self, tag, namespaces - ); + st->elementpath_obj, &PyId_iterfind, "OOO", self, tag, namespaces); } static PyObject*
