bpo-43399: Fix ElementTree.extend not working on iterators (GH-24751)

(cherry picked from commit 51a85ddce8)

Co-authored-by: Alex Prengère <2138730+alexprengere@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2021-03-30 14:36:25 -07:00 committed by GitHub
parent cd82d59206
commit b500bd8e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View File

@ -312,6 +312,9 @@ def test_simpleops(self):
elem.extend([e])
self.serialize_check(elem, '<body><tag /><tag2 /></body>')
elem.remove(e)
elem.extend(iter([e]))
self.serialize_check(elem, '<body><tag /><tag2 /></body>')
elem.remove(e)
element = ET.Element("tag", key="value")
self.serialize_check(element, '<tag key="value" />') # 1

View File

@ -252,7 +252,7 @@ def extend(self, elements):
"""
for element in elements:
self._assert_is_element(element)
self._children.extend(elements)
self._children.append(element)
def insert(self, index, subelement):
"""Insert *subelement* at position *index*."""

View File

@ -1363,6 +1363,7 @@ Matheus Vieira Portela
Davin Potts
Guillaume Pratte
Florian Preinstorfer
Alex Prengère
Amrit Prem
Paul Prescod
Donovan Preston

View File

@ -0,0 +1,2 @@
Fix ``ElementTree.extend`` not working on iterators when using the
Python implementation