[Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.23,1.24

Jeremy Hylton jhylton@users.sourceforge.net
2001年7月30日 14:49:24 -0700


Update of /cvsroot/python/python/dist/src/Lib/xml/sax
In directory usw-pr-cvs1:/tmp/cvs-serv16952/Lib/xml/sax
Modified Files:
	expatreader.py 
Log Message:
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.
Index: expatreader.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** expatreader.py	2001年06月17日 07:05:43	1.23
--- expatreader.py	2001年07月30日 21:49:22	1.24
***************
*** 18,21 ****
--- 18,24 ----
 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
 

AltStyle によって変換されたページ (->オリジナル) /