Commit e3c37d66 authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent 3c19ec4e
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment