summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2013-04-06 07:56:20 +0200
committerStefan Behnel <stefan_ml@behnel.de>2013-04-06 07:56:20 +0200
commitc536168368fb97f25271647ad351977dc04383c2 (patch)
tree28724799fca8e3cf8667e1c803e3da58b0e156d4
parentf8464843a932b096ae1888e36b7340c54f1eeb57 (diff)
downloadpython-lxml-c536168368fb97f25271647ad351977dc04383c2.tar.gz
work-around to reduce tree iteration overhead a bit
-rw-r--r--src/lxml/lxml.etree.pyx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lxml/lxml.etree.pyx b/src/lxml/lxml.etree.pyx
index fe8e9ab7..2c65c1c5 100644
--- a/src/lxml/lxml.etree.pyx
+++ b/src/lxml/lxml.etree.pyx
@@ -2713,8 +2713,10 @@ cdef class ElementDepthFirstIterator:
c_node = self._nextNodeAnyTag(c_node)
else:
c_node = self._nextNodeMatchTag(c_node)
- self._next_node = (_elementFactory(current_node._doc, c_node)
- if c_node is not NULL else None)
+ if c_node is NULL:
+ self._next_node = None
+ else:
+ self._next_node = _elementFactory(current_node._doc, c_node)
return current_node
cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):