summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2012-03-05 06:01:49 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2012-03-05 06:01:49 (GMT)
commit67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1 (patch)
treed97df086ba7d0659893935d3213f118b4714f2aa /Lib/xml
parentf1c42599bae9fcc47eb5f5d38ff077c000fef38f (diff)
downloadcpython-67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1.zip
cpython-67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1.tar.gz
cpython-67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1.tar.bz2
Issue #14168: Check for presence of _attrs before accessing it.
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/dom/minidom.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 7e2f88e..3de8a4d 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -723,12 +723,16 @@ class Element(Node):
Node.unlink(self)
def getAttribute(self, attname):
+ if self._attrs is None:
+ return ""
try:
return self._attrs[attname].value
except KeyError:
return ""
def getAttributeNS(self, namespaceURI, localName):
+ if self._attrsNS is None:
+ return ""
try:
return self._attrsNS[(namespaceURI, localName)].value
except KeyError: