[Python-checkins] CVS: python/dist/src/Lib dbhash.py,1.4,1.5
Skip Montanaro
montanaro@users.sourceforge.net
Thu, 25 Jan 2001 05:47:03 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv23145
Modified Files:
dbhash.py
Log Message:
fail more completely by deleting dbhash from sys.modules if bsddb can't be
loaded - prevents second import later from succeeding spuriously - mostly of
use in regression tests where the module might get imported more than once
Index: dbhash.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dbhash.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** dbhash.py 2001/01/20 19:54:20 1.4
--- dbhash.py 2001/01/25 13:47:00 1.5
***************
*** 1,5 ****
"""Provide a (g)dbm-compatible interface to bsdhash.hashopen."""
! import bsddb
__all__ = ["error","open"]
--- 1,11 ----
"""Provide a (g)dbm-compatible interface to bsdhash.hashopen."""
! import sys
! try:
! import bsddb
! except ImportError:
! # prevent a second import of this module from spuriously succeeding
! del sys.modules[__name__]
! raise
__all__ = ["error","open"]