Skip to content

Commit 86fc36b

Browse files
committed
Remove source=self from ResourceWarning
Removing source=self prevents unraisable exception in C extension. The warning message still contains the filename via %r formatting. Signed-off-by: Osama Abdelkader <[email protected]>
1 parent 6e3b071 commit 86fc36b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Lib/xml/etree/ElementTree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,7 @@ def close(self):
12711271

12721272
def __del__(self, _warn=warnings.warn):
12731273
if close_source:
1274-
_warn("unclosed file %r" % (source,),
1275-
ResourceWarning, source=self)
1274+
_warn("unclosed file %r" % (source,), ResourceWarning)
12761275
source.close()
12771276

12781277
it = IterParseIterator()

0 commit comments

Comments
 (0)