summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/dom/minidom.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index ef1a2bf..b4ae267 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -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()