[issue7214] TreeBuilder.end(tag) differs between cElementTree and ElementTree

Brian report at bugs.python.org
Tue Oct 27 00:32:30 CET 2009


New submission from Brian <brian at merrells.org>:

In the pure python ElementTree, the tag passed to the end() tag is
verified to be closing the last tag opened (self._last).

This cElementTree performs no such validation and closes the last tag
regardless of what tag is passed to the method.

In my mind this raises a couple questions beyond simply fixing this
discrepancy.
1)  Why make this tag mandatory if it has no effect in the cElementTree
version (and in the pure python version is only used to verify the user
isn't confused what tag they are closing)
2)  Could the argument be removed, simply closing the last tag if not
present?
3)  Or could the behavior be changed to actually influence which tag is
closed, allowing one to close all tags out to a specific
outer/encompassing tag (much like close(), closes all tags)?

-brian

----------
components: Library (Lib)
messages: 94542
nosy: merrellb
severity: normal
status: open
title: TreeBuilder.end(tag) differs between cElementTree and ElementTree
type: behavior
versions: Python 2.6

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


More information about the Python-bugs-list mailing list