summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-11-24 08:26:01 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-11-24 08:26:01 (GMT)
commit65730a4de80b5446d4bd3301098c1c053af99b27 (patch)
treea83b507e0bfef8a7be9751d0ea6d573f9c89ac88 /Lib
parentd332c085ea72e2c149e84f54d4b3afbb1eaeb1e3 (diff)
downloadcpython-65730a4de80b5446d4bd3301098c1c053af99b27.zip
cpython-65730a4de80b5446d4bd3301098c1c053af99b27.tar.gz
cpython-65730a4de80b5446d4bd3301098c1c053af99b27.tar.bz2
Delete bsddb from sys.modules if _bsddb cannot be imported.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/bsddb/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py
index a2d820c..1bec33b 100644
--- a/Lib/bsddb/__init__.py
+++ b/Lib/bsddb/__init__.py
@@ -43,7 +43,14 @@ People interested in the more advanced capabilites of Berkeley DB 3.x
should use the bsddb3.db module directly.
"""
-import _bsddb
+try:
+ import _bsddb
+except ImportError:
+ # Remove ourselves from sys.modules
+ import sys
+ del sys.modules[__name__]
+ raise
+
# bsddb3 calls it _db
_db = _bsddb
__version__ = _db.__version__