]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Don't raise MemoryError in keys() when the database is empty.
authorGuido van Rossum <guido@python.org>
Thu, 22 Mar 2001 00:19:22 +0000 (00:19 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 22 Mar 2001 00:19:22 +0000 (00:19 +0000)
This fixes SF bug #410146 (python 2.1b shelve is broken).

Modules/bsddbmodule.c

index ecfb653d8e44f0796e962b5c8855788f29d8f6d3..be50208b631166ee4969d2c6206689ea464b9b73 100644 (file)
@@ -427,7 +427,7 @@ bsddb_keys(bsddbobject *dp, PyObject *args)
                if (data != NULL) memcpy(data,krec.data,krec.size);
        }
        BSDDB_END_SAVE(dp)
-       if (data==NULL) return PyErr_NoMemory();
+       if (status == 0 && data==NULL) return PyErr_NoMemory();
        while (status == 0) {
                if (dp->di_type == DB_RECNO)
                        item = PyInt_FromLong(*((int*)data));