Issue #14168: Check for presence of _attrs before accessing it.
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 @@
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: