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
Next Next commit
Use % formatting instead of f-strings in __del__
F-strings can fail during cleanup. Use % formatting like
subprocess.Popen does for safer __del__ behavior.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
  • Loading branch information
osamakader committed Oct 26, 2025
commit fcd7ca09a77f22aa6362bce805746c4254d0a5ec
2 changes: 1 addition & 1 deletion Lib/xml/etree/ElementTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ def close(self):

def __del__(self, _warn=warnings.warn):
if close_source:
_warn(f"unclosed file {source!r}",
_warn("unclosed file %r" % (source,),
ResourceWarning, source=self)
source.close()

Expand Down
Loading