From: Guido van Rossum Date: Thu, 22 Mar 2001 00:19:22 +0000 (+0000) Subject: Don't raise MemoryError in keys() when the database is empty. X-Git-Tag: v2.1b2~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec24c1bc32d06a8c9af5cacfbbca28e6175d6ed4;p=thirdparty%2FPython%2Fcpython.git Don't raise MemoryError in keys() when the database is empty. This fixes SF bug #410146 (python 2.1b shelve is broken). --- diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c index ecfb653d8e44..be50208b6311 100644 --- a/Modules/bsddbmodule.c +++ b/Modules/bsddbmodule.c @@ -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));