xml.etree.ElementTree.extend does not work with iterators on Pypy3 (Pypy2 is fine)
xml.etree.ElementTree.extend
works well with lists on Pypy2/Pypy3, but when passing an iterator, there is a difference, and it is Pypy2 that behaves like Cpython2.7/3.x.
Pypy2 and Cpython:
>>>> from xml.etree.ElementTree import Element
>>>> r = Element("root")
>>>> r.extend((Element(str(i)) for i in range(3)))
>>>> print(list(r))
[<Element '0' at 0x...>, <Element '1' at 0x...>, <Element '2' at 0x...>]
On Pypy3 7.3:
>>>> from xml.etree.ElementTree import Element
>>>> r = Element("root")
>>>> r.extend((Element(str(i)) for i in range(3)))
>>>> print(list(r))
[]
Looking at what changed in lib-python/xx/xml/etree/ElementTree.py
between Pypy2/Pypy3, there is an additional _assert_is_element
that may be responsible for emptying the iterator.
class Element:
...
def extend(self, elements):
"""Append subelements from a sequence.
*elements* is a sequence with zero or more elements.
"""
+++ for element in elements:
+++ self._assert_is_element(element)
self._children.extend(elements)