[issue13782] xml.etree.ElementTree: Element.append doesn't type-check its argument

Eli Bendersky report at bugs.python.org
Sat Mar 17 07:12:31 CET 2012


Eli Bendersky <eliben at gmail.com> added the comment:

Attaching a patch that sets the record straight in 3.3 - the 3 methods will raise TypeError, in both C and Python implementations. Also adds a test that verifies this, and updating the documentation.

Note that in the C implementation extend wasn't actually type-checking its argument as well, so I added it for consistency. I don't believe this will be a performance problem. On the contrary, there are some type checking calls inside the implementation that can probably be removed now that we make sure only subclasses of Element get in as children. I'll look into this later.

----------
keywords: +patch
Added file: http://bugs.python.org/file24897/issue13782.1.patch

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


More information about the Python-bugs-list mailing list