mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Delete bsddb from sys.modules if _bsddb cannot be imported.
This commit is contained in:
parent
d332c085ea
commit
65730a4de8
1 changed files with 8 additions and 1 deletions
|
|
@ -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__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue