Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec24c1b

Browse files
committed
Don't raise MemoryError in keys() when the database is empty.
This fixes SF bug #410146 (python 2.1b shelve is broken).
1 parent 24a4191 commit ec24c1b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Modules/bsddbmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ bsddb_keys(bsddbobject *dp, PyObject *args)
427427
if (data != NULL) memcpy(data,krec.data,krec.size);
428428
}
429429
BSDDB_END_SAVE(dp)
430-
if (data==NULL) return PyErr_NoMemory();
430+
if (status == 0 && data==NULL) return PyErr_NoMemory();
431431
while (status == 0) {
432432
if (dp->di_type == DB_RECNO)
433433
item = PyInt_FromLong(*((int*)data));

0 commit comments

Comments
 (0)