-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-43292: Fix file leak in ET.iterparse()
when not exhausted
#31696
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
bpo-43292: Fix file leak in ET.iterparse()
when not exhausted
#31696
Conversation
There was a problem hiding this 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()
,
Thanks @jacobtylerwalls for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Thanks @jacobtylerwalls for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
…onGH-31696) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
GH-31720 is a backport of this pull request to the 3.9 branch. |
GH-31721 is a backport of this pull request to the 3.10 branch. |
…onGH-31696) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit 496c428) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
…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>
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 foriterparse()
. I am not certain if that feature would still be desired after this change.https://bugs.python.org/issue43292