GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — gh-69893: Add the close() method for xml.etree.ElementTree.iterparse() iterator by serhiy-storchaka · Pull Request #114534 · python/cpython Conversation
|
| iterparse(SIMPLE_XMLFILE, events) | ||
| self.assertEqual(str(cm.exception), "unknown event 'bogus'") | ||
| del cm | ||
| gc_collect() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The added gc_collect() calls are redundant because the check_no_resource_warning() context manager already calls gc_collect().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nice. The initial version of my patch predates check_no_resource_warning().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| gen.close() | ||
|
|
||
| def __del__(self): | ||
| # TODO: Emit a ResourceWarning if it was not explicitly closed. |
There was a problem 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 :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
When all maintained Python versions have the close() method, so you can call it without checking the version.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.