]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Since pyexpat isn't always available in Python 2.2, allow repeated
authorFred Drake <fdrake@acm.org>
Thu, 8 Aug 2002 14:34:12 +0000 (14:34 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 8 Aug 2002 14:34:12 +0000 (14:34 +0000)
imports of xml.parsers.expat to raise ImportError if pyexpat isn't
available.

Not needed in Python 2.3, since pyexpat is always built there.

Lib/xml/parsers/expat.py

index 11359a0b27613d6203f96654adcdc0e2a62d9072..dfcdd15d411d9f179616f97dd19aa8ff9163a88e 100644 (file)
@@ -1,4 +1,13 @@
 """Interface to the Expat non-validating XML parser."""
 __version__ = '$Revision$'
 
-from pyexpat import *
+import sys
+
+try:
+    from pyexpat import *
+except ImportError:
+    del sys.modules[__name__]
+    del sys
+    raise
+
+del sys