From: Fred Drake Date: Thu, 8 Aug 2002 14:34:12 +0000 (+0000) Subject: Since pyexpat isn't always available in Python 2.2, allow repeated X-Git-Tag: v2.2.2b1~232 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0256444b79e7068a1bfa43a4a995036e376f13fb;p=thirdparty%2FPython%2Fcpython.git Since pyexpat isn't always available in Python 2.2, allow repeated 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. --- diff --git a/Lib/xml/parsers/expat.py b/Lib/xml/parsers/expat.py index 11359a0b2761..dfcdd15d411d 100644 --- a/Lib/xml/parsers/expat.py +++ b/Lib/xml/parsers/expat.py @@ -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