This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: dbhash __len__ not reliable
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, chrismorvant, gregory.p.smith
Priority: normal Keywords:

Created on 2006-07-03 01:12 by chrismorvant, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg60936 - (view) Author: cmorvant (chrismorvant) Date: 2006-07-03 01:12
Python Version 2.4.3
OS Windows XP

When I open a db file in read only mode('r') 
the 'len' method will only work once.  After this it 
will return only 0.  Using anydbm on my windows box 
defaults to dbhash(bsddb).  This only occurs with 
dbhash(dumbdbm and dbm on Unix work fine).  The 
output of the sample code is "2 0 dbhash".
msg60937 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-07-03 22:12
Logged In: YES 

Can you please provide a small test script that demonstrates
the problem?  When I try opening a dbhash database and
calling len(), it returns the correct results.

msg61564 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-01-23 07:35
Works for me in 2.5 and 2.4 isn't getting bug fixes anymore.

>>> import dbhash
>>> d ='x.db', 'w')
>>> d['e'] = 'Eee'
>>> d['f'] = 'Ffff'
>>> len(d)
>>> len(d)

It was likely fixed by this:

r46684 | gregory.p.smith | 2006-06-05 16:59:37 -0700 (Mon, 05 Jun 2006)
| 5 line

- bsddb: the __len__ method of a DB object has been fixed to return correct
  results.  It could previously incorrectly return 0 in some cases.
  Fixes SF bug 1493322 (pybsddb bug 1184012).
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43600
2008-01-23 07:35:54gregory.p.smithsetstatus: open -> closed
resolution: fixed
messages: + msg61564
nosy: + gregory.p.smith
2006-07-03 01:12:59chrismorvantcreate