Message255159
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. |
|
Date |
User |
Action |
Args |
2015-11-23 13:57:25 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka |
2015-11-23 13:57:25 | serhiy.storchaka | set | messageid: <1448287045.22.0.0931965485798.issue25707@psf.upfronthosting.co.za> |
2015-11-23 13:57:25 | serhiy.storchaka | link | issue25707 messages |
2015-11-23 13:57:25 | serhiy.storchaka | create | |
|