Commit 4d463433 authored by Victor Stinner's avatar Victor Stinner

Cleanup _elementtree.c

parent 5f0af23f
...@@ -529,7 +529,6 @@ subelement(PyObject *self, PyObject *args, PyObject *kwds) ...@@ -529,7 +529,6 @@ subelement(PyObject *self, PyObject *args, PyObject *kwds)
} }
elem = create_new_element(tag, attrib); elem = create_new_element(tag, attrib);
Py_DECREF(attrib); Py_DECREF(attrib);
if (element_add_subelement(parent, elem) < 0) { if (element_add_subelement(parent, elem) < 0) {
...@@ -1784,10 +1783,10 @@ element_setattro(ElementObject* self, PyObject* nameobj, PyObject* value) ...@@ -1784,10 +1783,10 @@ element_setattro(ElementObject* self, PyObject* nameobj, PyObject* value)
char *name = ""; char *name = "";
if (PyUnicode_Check(nameobj)) if (PyUnicode_Check(nameobj))
name = _PyUnicode_AsString(nameobj); name = _PyUnicode_AsString(nameobj);
if (name == NULL)
if (name == NULL) {
return -1; return -1;
} else if (strcmp(name, "tag") == 0) {
if (strcmp(name, "tag") == 0) {
Py_DECREF(self->tag); Py_DECREF(self->tag);
self->tag = value; self->tag = value;
Py_INCREF(self->tag); Py_INCREF(self->tag);
...@@ -2135,15 +2134,15 @@ create_elementiter(ElementObject *self, PyObject *tag, int gettext) ...@@ -2135,15 +2134,15 @@ create_elementiter(ElementObject *self, PyObject *tag, int gettext)
if (star && PyObject_RichCompareBool(tag, star, Py_EQ) == 1) if (star && PyObject_RichCompareBool(tag, star, Py_EQ) == 1)
tag = Py_None; tag = Py_None;
Py_XDECREF(star); Py_XDECREF(star);
Py_INCREF(tag);
it->sought_tag = tag; it->sought_tag = tag;
it->root_done = 0; it->root_done = 0;
it->gettext = gettext; it->gettext = gettext;
Py_INCREF(self);
it->root_element = self; it->root_element = self;
Py_INCREF(self);
Py_INCREF(tag);
PyObject_GC_Track(it); PyObject_GC_Track(it);
return (PyObject *)it; return (PyObject *)it;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment