[New-bugs-announce] [issue43292] xml.ElementTree iterparse filehandle left open

Viktor Kis report at bugs.python.org
Sun Feb 21 23:11:29 EST 2021

New submission from Viktor Kis <vkisforever at gmail.com>:

Standard library xml.ElementTree - iterparse does not close filehandle properly when breaking out of a for loop iterating with iterparse. The issue only occurs when the user passes a "string" as a source object instead of a filehandle (that is because a user's filehandle can safely be closed in a context manager as shown in the attachment).

components: XML
files: ETiterparse.py
messages: 387494
nosy: vkisforever
priority: normal
severity: normal
status: open
title: xml.ElementTree iterparse filehandle left open
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file49826/ETiterparse.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list