[Python-checkins] python/dist/src/Lib whichdb.py,1.12,1.12.8.1
loewis@users.sourceforge.net
loewis@users.sourceforge.net
2003年6月14日 01:17:30 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv1748/Lib
Modified Files:
Tag: release22-maint
whichdb.py
Log Message:
Treat empty dat/dir files as dumbdbm. Fixes #744687.
Index: whichdb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v
retrieving revision 1.12
retrieving revision 1.12.8.1
diff -C2 -d -r1.12 -r1.12.8.1
*** whichdb.py 24 Oct 2001 20:33:34 -0000 1.12
--- whichdb.py 14 Jun 2003 08:17:28 -0000 1.12.8.1
***************
*** 30,35 ****
# Check for dumbdbm next -- this has a .dir and and a .dat file
try:
! f = open(filename + os.extsep + "dat", "rb")
! f.close()
f = open(filename + os.extsep + "dir", "rb")
try:
--- 30,39 ----
# Check for dumbdbm next -- this has a .dir and and a .dat file
try:
! # First check for presence of files
! sizes = os.stat(filename + os.extsep + "dat").st_size, \
! os.stat(filename + os.extsep + "dir").st_size
! # dumbdbm files with no keys are empty
! if sizes == (0, 0):
! return "dumbdbm"
f = open(filename + os.extsep + "dir", "rb")
try:
***************
*** 38,42 ****
finally:
f.close()
! except IOError:
pass
--- 42,46 ----
finally:
f.close()
! except (OSError, IOError):
pass