summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-07-30 21:49:22 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-07-30 21:49:22 (GMT)
commite3c37d660f5641f55c12313fde8e20f8178d942a (patch)
treeac0ecc369614a80dc45e7164edf6243b6f9e7426 /Lib
parent3c19ec4eab4dbee3494cd8b8db715e2939d2b917 (diff)
downloadcpython-e3c37d660f5641f55c12313fde8e20f8178d942a.zip
cpython-e3c37d660f5641f55c12313fde8e20f8178d942a.tar.gz
cpython-e3c37d660f5641f55c12313fde8e20f8178d942a.tar.bz2
Ugly fix used when pyexpat is not available.
If pyexpat is not available and more than one attempt is made to load an expat-based xml parser, an empty xml.parser.expat module will be created. This empty module will confuse xml.sax.expatreader into thinking that pyexpat is available. The ugly fix is to verify that the expat module actually defines the names that are imported from pyexpat.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/xml/sax/expatreader.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py
index b8a31ff..7c2bb89 100644
--- a/Lib/xml/sax/expatreader.py
+++ b/Lib/xml/sax/expatreader.py
@@ -17,6 +17,9 @@ try:
from xml.parsers import expat
except ImportError:
raise SAXReaderNotAvailable("expat not supported",None)
+else:
+ if not hasattr(expat, "ParserCreate"):
+ raise SAXReaderNotAvailable("expat not supported",None)
from xml.sax import xmlreader, saxutils, handler
AttributesImpl = xmlreader.AttributesImpl