[Lxml-checkins] r46554 - lxml/trunk/src/lxml

scoder at codespeak.net scoder at codespeak.net
Thu Sep 13 19:40:57 CEST 2007


Author: scoder
Date: Thu Sep 13 19:40:57 2007
New Revision: 46554

Modified:
   lxml/trunk/src/lxml/iterparse.pxi
Log:
small cleanup in iterwalk(): avoid testing truth value of Element

Modified: lxml/trunk/src/lxml/iterparse.pxi
==============================================================================
--- lxml/trunk/src/lxml/iterparse.pxi	(original)
+++ lxml/trunk/src/lxml/iterparse.pxi	Thu Sep 13 19:40:57 2007
@@ -391,6 +391,7 @@
         return self
 
     def __next__(self):
+        cdef xmlNode* c_child
         cdef _Element node
         cdef _Element next_node
         cdef int ns_count
@@ -399,13 +400,12 @@
         ns_count = 0
         # find next node
         while self._index >= 0:
-            node_tuple = python.PyList_GET_ITEM(self._node_stack, self._index)
-            python.Py_INCREF(node_tuple) # fix borrowed reference for Pyrex!
-            node = python.PyTuple_GET_ITEM(node_tuple, 0)
-            python.Py_INCREF(node) # fix borrowed reference for Pyrex!
-            if node:
+            node = self._node_stack[self._index][0]
+
+            c_child = _findChildForwards(node._c_node, 0)
+            if c_child is not NULL:
                 # try children
-                next_node = node[0]
+                next_node = _elementFactory(node._doc, c_child)
             else:
                 # back off
                 next_node = None


More information about the lxml-checkins mailing list