mirror of
https://github.com/python/cpython
synced 2024-10-05 07:19:38 +00:00
[3.12] gh-114737: Revert change to ElementTree.iterparse "root" attribute (GH-114755) (GH-114798)
Prior to gh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
(cherry picked from commit 66f95ea6a6
)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
0536bbb192
commit
5d7b90db0c
|
@ -536,7 +536,9 @@ def test_iterparse(self):
|
|||
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'),
|
||||
|
|
|
@ -1256,8 +1256,8 @@ def __del__(self):
|
|||
source.close()
|
||||
|
||||
it = IterParseIterator()
|
||||
it.root = None
|
||||
wr = weakref.ref(it)
|
||||
del IterParseIterator
|
||||
return it
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue