Prior to gh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
iterparse = ET.iterparse
context = iterparse(SIMPLE_XMLFILE)
+ self.assertIsNone(context.root)
action, elem = next(context)
+ self.assertIsNone(context.root)
self.assertEqual((action, elem.tag), ('end', 'element'))
self.assertEqual([(action, elem.tag) for action, elem in context], [
('end', 'element'),
source.close()
it = IterParseIterator()
+ it.root = None
wr = weakref.ref(it)
- del IterParseIterator
return it