[Python-checkins] cpython: Cleanup _elementtree.c
victor.stinner
python-checkins at python.org
Thu Jul 11 23:12:15 CEST 2013
http://hg.python.org/cpython/rev/e1b398d0decb
changeset: 84567:e1b398d0decb
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Jul 11 23:05:03 2013 +0200
summary:
Cleanup _elementtree.c
files:
Modules/_elementtree.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -529,7 +529,6 @@
}
elem = create_new_element(tag, attrib);
-
Py_DECREF(attrib);
if (element_add_subelement(parent, elem) < 0) {
@@ -1784,10 +1783,10 @@
char *name = "";
if (PyUnicode_Check(nameobj))
name = _PyUnicode_AsString(nameobj);
-
- if (name == NULL) {
+ if (name == NULL)
return -1;
- } else if (strcmp(name, "tag") == 0) {
+
+ if (strcmp(name, "tag") == 0) {
Py_DECREF(self->tag);
self->tag = value;
Py_INCREF(self->tag);
@@ -2135,15 +2134,15 @@
if (star && PyObject_RichCompareBool(tag, star, Py_EQ) == 1)
tag = Py_None;
-
Py_XDECREF(star);
+
+ Py_INCREF(tag);
it->sought_tag = tag;
it->root_done = 0;
it->gettext = gettext;
+ Py_INCREF(self);
it->root_element = self;
- Py_INCREF(self);
- Py_INCREF(tag);
PyObject_GC_Track(it);
return (PyObject *)it;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list