Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-69893: Add the close() method for xml.etree.ElementTree.iterparse() iterator#114534

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedJan 24, 2024
edited by github-actionsbot
Loading

@@ -608,6 +619,7 @@ def test_iterparse(self):
iterparse(SIMPLE_XMLFILE, events)
self.assertEqual(str(cm.exception), "unknown event 'bogus'")
del cm
gc_collect()
Copy link
Contributor

Choose a reason for hiding this comment

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

The addedgc_collect() calls are redundant because thecheck_no_resource_warning() context manager already callsgc_collect().

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Nice. The initial version of my patch predatescheck_no_resource_warning().


def __del__(self):
# TODO: Emit a ResourceWarning if it was not explicitly closed.
Copy link
Member

Choose a reason for hiding this comment

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

Any plans for when this TODO will be done? They can end up languishing for decades :)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

When all maintained Python versions have theclose() method, so you can call it without checking the version.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe update the TODO to mention this, so when someone sees it they know whether they can do the TODO or wait a bit longer?

Anyway, I'll approve this.

Copy link
Member

@hugovkhugovk left a comment

Choose a reason for hiding this comment

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

Thanks!

@serhiy-storchakaserhiy-storchaka merged commitca715e5 intopython:mainFeb 4, 2024
@serhiy-storchakaserhiy-storchaka deleted the etree-iterparse-close branchFebruary 4, 2024 15:25
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull requestFeb 14, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@colesburycolesburycolesbury left review comments

@hugovkhugovkhugovk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@serhiy-storchaka@colesbury@hugovk

[8]ページ先頭

©2009-2025 Movatter.jp