summaryrefslogtreecommitdiff
path: root/Lib/xml
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2012-03-05 07:01:49 +0100
committerMartin v. Löwis <martin@v.loewis.de>2012-03-05 07:01:49 +0100
commitf1b40ab4afa8f5236e7a54c485a4cd5f99d29313 (patch)
tree002d0daab09be59453000a916c0375f762e21cfa /Lib/xml
parentd0bbf7b75596c738cd59e5f46bb56711ff786f23 (diff)
downloadcpython-f1b40ab4afa8f5236e7a54c485a4cd5f99d29313.tar.gz
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 7e2f88e360..3de8a4d496 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: