mirror of https://github.com/python/cpython.git
bpo-43399: Fix ElementTree.extend not working on iterators (GH-24751)
This commit is contained in:
parent
73b20ae2fb
commit
51a85ddce8
Lib
Misc
|
@ -330,6 +330,9 @@ def test_simpleops(self):
|
||||||
elem.extend([e])
|
elem.extend([e])
|
||||||
self.serialize_check(elem, '<body><tag /><tag2 /></body>')
|
self.serialize_check(elem, '<body><tag /><tag2 /></body>')
|
||||||
elem.remove(e)
|
elem.remove(e)
|
||||||
|
elem.extend(iter([e]))
|
||||||
|
self.serialize_check(elem, '<body><tag /><tag2 /></body>')
|
||||||
|
elem.remove(e)
|
||||||
|
|
||||||
element = ET.Element("tag", key="value")
|
element = ET.Element("tag", key="value")
|
||||||
self.serialize_check(element, '<tag key="value" />') # 1
|
self.serialize_check(element, '<tag key="value" />') # 1
|
||||||
|
|
|
@ -252,7 +252,7 @@ def extend(self, elements):
|
||||||
"""
|
"""
|
||||||
for element in elements:
|
for element in elements:
|
||||||
self._assert_is_element(element)
|
self._assert_is_element(element)
|
||||||
self._children.extend(elements)
|
self._children.append(element)
|
||||||
|
|
||||||
def insert(self, index, subelement):
|
def insert(self, index, subelement):
|
||||||
"""Insert *subelement* at position *index*."""
|
"""Insert *subelement* at position *index*."""
|
||||||
|
|
|
@ -1381,6 +1381,7 @@ Matheus Vieira Portela
|
||||||
Davin Potts
|
Davin Potts
|
||||||
Guillaume Pratte
|
Guillaume Pratte
|
||||||
Florian Preinstorfer
|
Florian Preinstorfer
|
||||||
|
Alex Prengère
|
||||||
Amrit Prem
|
Amrit Prem
|
||||||
Paul Prescod
|
Paul Prescod
|
||||||
Donovan Preston
|
Donovan Preston
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix ``ElementTree.extend`` not working on iterators when using the
|
||||||
|
Python implementation
|
Loading…
Reference in New Issue