[New-bugs-announce] [issue25814] Propagate all errors from ElementTree.iterparse

Serhiy Storchaka report at bugs.python.org
Sun Dec 6 10:00:03 EST 2015


New submission from Serhiy Storchaka:

Some memory errors raised in handlers during XML parsing are explicitly or implicitly propagated to the caller of XMLParser methods feed(), close(), and _parse_whole(). But others are silenced with PyErr_Clear() with added comments "FIXME: propagate error". There are no reasons why one errors are propagated and others are not. For example memory error during creating tuple is not propagated, but memory error during resizing a list to which this tuple is appended is propagated. Looks as this is not intentional.

Not propagated errors can cause the lost of events. Proposed patch makes the parser to propagate all errors. Since it extracts common code into the treebuilder_append_event() function and inlines the treebuilder_handle_namespace() function, the resulting code becomes even simpler, its size is decreased by 49 lines.

----------
components: Extension Modules, XML
files: etree_propagate_errors.patch
keywords: patch
messages: 256012
nosy: brett.cannon, scoder, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Propagate all errors from ElementTree.iterparse
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41256/etree_propagate_errors.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25814>
_______________________________________


More information about the New-bugs-announce mailing list