summaryrefslogtreecommitdiff
path: root/Lib/xml
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-21 11:11:12 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-21 11:11:12 +0200
commit47a9d59d5115fc2d9c29035d9ae4418eb1800f44 (patch)
tree98dd673665034bf1c0ccaa9f96ebd9222164ce89 /Lib/xml
parent0c477e6a8580056efaee07c15528edb7d037ce61 (diff)
parent66c08d90f6d7e5889a19891a0ef994354b14f172 (diff)
downloadcpython-git-47a9d59d5115fc2d9c29035d9ae4418eb1800f44.tar.gz
Issue #25902: Fixed various refcount issues in ElementTree iteration.
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/etree/ElementTree.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index a58ef31812..b92fb52124 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -429,12 +429,14 @@ class Element:
tag = self.tag
if not isinstance(tag, str) and tag is not None:
return
- if self.text:
- yield self.text
+ t = self.text
+ if t:
+ yield t
for e in self:
yield from e.itertext()
- if e.tail:
- yield e.tail
+ t = e.tail
+ if t:
+ yield t
def SubElement(parent, tag, attrib={}, **extra):