Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Lib/xml/etree/ElementTree.py
  • Loading branch information
serhiy-storchaka authored Jan 26, 2024
commit e527b59a5b1b3e0cf6e1ee99a445072c7e5a0206
1 change: 1 addition & 0 deletions Lib/xml/etree/ElementTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,7 @@ def close(self):

def __del__(self):
# TODO: Emit a ResourceWarning if it was not explicitly closed.
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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 the close() method, so you can call it without checking the version.

Copy link
Copy Markdown
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.

Comment thread
serhiy-storchaka marked this conversation as resolved.
# (When the close() method will be supported in all maintained Python versions.)
if close_source:
source.close()

Expand Down