Skip to content

Element.extend hides exceptions from underlying generators. #123213

Closed
@bharel

Description

@bharel

Bug report

Bug description:

>>> from xml.etree.ElementTree import Element
>>> Element("a").extend(Element("a") for i in range(10)) # works
>>> Element("a").extend(1/0 for i in range(10)) # throws unrelated TypeError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected sequence, not "generator"

C-implementation only bug.

Submitting a patch...

CPython versions tested on:

3.12, 3.13, CPython main branch

Operating systems tested on:

macOS, Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-XMLtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions