diff Lib/xml/etree/ElementTree.py @ 77217:7d252dbfbee3

Issue 14814: Add namespaces keyword arg to find(*) methods in _elementtree. Add attrib keyword to Element and SubElement in _elementtree. Patch developed with Ezio Melotti.
author Eli Bendersky <eliben@gmail.com>
date Tue, 29 May 2012 06:02:56 +0300
parents 75268a773455
children 652d148bdc1d
line wrap: on
line diff
--- a/Lib/xml/etree/ElementTree.py	Mon May 28 21:09:04 2012 -0400
+++ b/Lib/xml/etree/ElementTree.py	Tue May 29 06:02:56 2012 +0300
@@ -205,6 +205,9 @@
     # constructor
 
     def __init__(self, tag, attrib={}, **extra):
+        if not isinstance(attrib, dict):
+            raise TypeError("attrib must be dict, not %s" % (
+                attrib.__class__.__name__,))
         attrib = attrib.copy()
         attrib.update(extra)
         self.tag = tag