[Python-checkins] python/dist/src/Lib dumbdbm.py,1.27,1.28

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Sun, 13 Jul 2003 10:21:12 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv24717/Lib

Modified Files:
	dumbdbm.py 
Log Message:
Make close() identical to __del__() for a dumbdbm database.  Make
closing idempotent (it used to raise a nuisance exception on the 2nd
close attempt).

Bugfix candidate?  Probably, but arguable.


Index: dumbdbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** dumbdbm.py	13 Jul 2003 02:37:05 -0000	1.27
--- dumbdbm.py	13 Jul 2003 17:21:09 -0000	1.28
***************
*** 93,96 ****
--- 93,99 ----
          # be called from __del__().  Therefore we must never reference a
          # global in this routine.
+         if self._index is None:
+             return  # nothing to do
+ 
          try:
              self._os.unlink(self._bakfile)
***************
*** 205,214 ****
      def close(self):
          self._commit()
!         self._index = None
!         self._datfile = self._dirfile = self._bakfile = None
  
!     def __del__(self):
!         if self._index is not None:
!             self._commit()
  
  
--- 208,214 ----
      def close(self):
          self._commit()
!         self._index = self._datfile = self._dirfile = self._bakfile = None
  
!     __del__ = close