[issue13782] xml.etree.ElementTree: Element.append doesn't type-check its argument
Terry J. Reedy
report at bugs.python.org
Sat Jan 21 00:18:29 CET 2012
Terry J. Reedy <tjreedy at udel.edu> added the comment:
Confirmed with on 3.2.2 Win7 for all three methods.
Docs say .append should raise AssertionError (see below).
However, that is unusual and TypeError is normal practice.
I am not sure what to do.
Our docs say: '''
append(subelement)
Adds the element subelement to the end of this elements internal list of subelements.
extend(subelements)
Appends subelements from a sequence object with zero or more elements. Raises AssertionError if a subelement is not a valid object.
insert(index, element)
Inserts a subelement at the given position in this element.
'''
This implies to me that append and insert should do the same.
In fact, the current code has the assertion checks but they are commented out in all methods.
From
http://effbot.org/zone/pythondoc-elementtree-ElementTree.htm
"append ... Raises AssertionError:
If a sequence member is not a valid object."
Ditto for .insert
Florent: why are all the assertion checks commented out in
Changeset: 59511 (831e30c0fd73) Issue #6472:
The xml.etree package is updated to ElementTree 1.3.
(March 2010)
Is the change in Fredrik's code, in spite of his docs?
----------
nosy: +effbot, flox, terry.reedy
stage: -> test needed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13782>
_______________________________________
More information about the Python-bugs-list
mailing list