Skip to content

Conversation

@jacobtylerwalls
Copy link
Contributor

@jacobtylerwalls jacobtylerwalls commented Mar 5, 2022

bpo-43292: This fixes the file leak in xml.etree.ElementTree.iterparse when the iterator is garbage collected before being exhausted.

Regression test fails on main.


Related, but not done in this PR: bpo-25707 is a request for an explicit close() method for iterparse(). I am not certain if that feature would still be desired after this change.

https://bugs.python.org/issue43292

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if pass a path of non-existing file to iterparse(),

@serhiy-storchaka serhiy-storchaka merged commit 496c428 into python:main Mar 7, 2022
@serhiy-storchaka serhiy-storchaka added needs backport to 3.9 needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Mar 7, 2022
@miss-islington
Copy link
Contributor

Thanks @jacobtylerwalls for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @jacobtylerwalls for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 7, 2022
…onGH-31696) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@bedevere-bot
Copy link

GH-31720 is a backport of this pull request to the 3.9 branch.

@bedevere-bot
Copy link

GH-31721 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 7, 2022
…onGH-31696) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
miss-islington added a commit that referenced this pull request Mar 7, 2022
…1696) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
serhiy-storchaka pushed a commit that referenced this pull request Mar 7, 2022
…GH-31696) (GH-31720) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@jacobtylerwalls jacobtylerwalls deleted the iterparse-file-cleanup branch March 7, 2022 13:02
hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…pythonGH-31696) (pythonGH-31720) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

5 participants