From 0256444b79e7068a1bfa43a4a995036e376f13fb Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Thu, 8 Aug 2002 14:34:12 +0000 Subject: [PATCH] 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. --- Lib/xml/parsers/expat.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- 2.47.3