You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the old bsddb module a bsddb.btopen(..) database
would return the next available key+value on a
set_location(key) call when key did not exist in the
database. In python 2.3 (pybsddb) it raises an
exception and leaves the cursor at an unknown position
in the database.
[reported by Anthony McDonaly on comp.lang.python]
>>> import os
>>> import bsddb
>>> os.chdir('/tmp')
>>> my_data = bsddb.btopen('testing', 'c')
>>> for i inrange(10):
... if i ==5:
... pass
... else:
... my_data['%d'%i] ='%d'%(i*i)
...
>>> my_data.keys()
['0', '1', '2', '3', '4', '6', '7', '8', '9']
>>> my_data.sync()
>>> my_data.set_location('5')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/space/python-2.3/lib/python2.3/bsddb/__init__.py",
line 117, in set_location
return self.dbc.set(key)
_bsddb.DBNotFoundError: (-30991, 'DB_NOTFOUND: No
matching key/data pair found')
Correct behaviour would have been to return ('6', '36')
committed fix to head and release23-maint along with an associated fix for set_range where it could free() memory that it doesn't own on non B-Tree databases.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: