Author serhiy.storchaka
Recipients serhiy.storchaka
Date 2015-11-23.13:57:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1448287045.22.0.0931965485798.issue25707@psf.upfronthosting.co.za>
In-reply-to
Content
If ElementTree.iterparse() is called with file names, it opens a file. When resulting iterator is not exhausted, the file lefts not closed.

>>> import xml.etree.ElementTree as ET
>>> import gc
>>> ET.iterparse('/dev/null')
<xml.etree.ElementTree._IterParseIterator object at 0xb6f9e38c>
>>> gc.collect()
__main__:1: ResourceWarning: unclosed file <_io.BufferedReader name='/dev/null'>
34

Martin Panter proposed in issue25688 to add an explicit way to clean it up, like a generator.close() method.
History
Date User Action Args
2015-11-23 13:57:25serhiy.storchakasetrecipients: + serhiy.storchaka
2015-11-23 13:57:25serhiy.storchakasetmessageid: <1448287045.22.0.0931965485798.issue25707@psf.upfronthosting.co.za>
2015-11-23 13:57:25serhiy.storchakalinkissue25707 messages
2015-11-23 13:57:25serhiy.storchakacreate