Patch #103854: raises an exception if a non-Attr node is passed to

NamedNodeMap.setNamedItem().  Martin, should I sync the PyXML tree, too,
 or do you want to do it?  (I don't know if you're wrapping the 0.6.4
 release right now.)
This commit is contained in:
Andrew M. Kuchling 2001-02-21 01:30:26 +00:00
parent 8b94b1c74a
commit bc8f72cccc
2 changed files with 14 additions and 0 deletions

View file

@ -378,6 +378,9 @@ class NamedNodeMap:
self.setNamedItem(node)
def setNamedItem(self, node):
if not isinstance(node, Attr):
raise HierarchyRequestErr, \
"%s cannot be child of %s" % (repr(node), repr(self))
old = self._attrs.get(node.name)
if old:
old.unlink()