Skip to content

Fix unintended behavior change in elementtree introduced in #114269 #114737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Prometheus3375 opened this issue Jan 29, 2024 · 1 comment
Closed
Assignees
Labels
3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes topic-XML type-bug An unexpected behavior, bug, or error

Comments

@Prometheus3375
Copy link
Contributor

Prometheus3375 commented Jan 29, 2024

Bug report

Bug description:

As it was discussed here, after merging of #114269 it.root is no longer None once an iterator is created. There was no intention to change this, it should be reverted.

Meanwhile, I think it will be good to add test for root attribute.

  • Right after function returned iterator: it.root must be None.
  • After iterator exhaustion: it.root must be an instance of xml.etree.ElementTree.Element.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs

@Prometheus3375 Prometheus3375 added the type-bug An unexpected behavior, bug, or error label Jan 29, 2024
@Eclips4 Eclips4 added the 3.13 bugs and security fixes label Jan 30, 2024
@ronaldoussoren ronaldoussoren changed the title Fix unintended behavior change introduced in #114269 Fix unintended behavior change in elementtree introduced in #114269 Jan 30, 2024
colesbury added a commit to colesbury/cpython that referenced this issue Jan 30, 2024
Prior to pythongh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
@serhiy-storchaka serhiy-storchaka added 3.11 only security fixes 3.12 only security fixes labels Jan 31, 2024
serhiy-storchaka pushed a commit that referenced this issue Jan 31, 2024
…H-114755)

Prior to gh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 31, 2024
…ute (pythonGH-114755)

Prior to pythongh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
(cherry picked from commit 66f95ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 31, 2024
…ute (pythonGH-114755)

Prior to pythongh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
(cherry picked from commit 66f95ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@serhiy-storchaka
Copy link
Member

Thank you for your report @Prometheus3375.

serhiy-storchaka pushed a commit that referenced this issue Jan 31, 2024
…bute (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 66f95ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
serhiy-storchaka pushed a commit that referenced this issue Jan 31, 2024
…bute (GH-114755) (GH-114799)

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 66f95ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…ute (pythonGH-114755)

Prior to pythongh-114269, the iterator returned by ElementTree.iterparse was
initialized with the root attribute as None. This restores the previous
behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes topic-XML type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants