diff options
author | Eli Bendersky <eliben@gmail.com> | 2012-05-29 03:02:56 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2012-05-29 03:02:56 (GMT) |
commit | 737b173355b0473d134b1715dd8b1695eb023d8b (patch) | |
tree | 5921978a2a92a9298c2b01f93de7a94e6ee0d25a /Lib/xml/etree/ElementTree.py | |
parent | 6bed342b5895c816ac8d731d780ca6f01f8ea875 (diff) | |
download | cpython-737b173355b0473d134b1715dd8b1695eb023d8b.zip cpython-737b173355b0473d134b1715dd8b1695eb023d8b.tar.gz cpython-737b173355b0473d134b1715dd8b1695eb023d8b.tar.bz2 |
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.
Diffstat (limited to 'Lib/xml/etree/ElementTree.py')
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index 5f974f6..e068fc2 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -205,6 +205,9 @@ class Element: # 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 |