]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 42173: get bsddb test_associate to pass with BSDDB 4.1
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 26 Jan 2006 05:19:56 +0000 (05:19 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 26 Jan 2006 05:19:56 +0000 (05:19 +0000)
Modules/_bsddb.c

index c6efa1cc901a8d6b5f7e95c5bfaea3e8121ec294..07c56cdd66b26196d4ce2a9bab7270844eda7bcd 100644 (file)
@@ -906,7 +906,7 @@ DBEnv_dealloc(DBEnvObject* self)
     }
 #endif
 
-    if (self->db_env) {
+    if (self->db_env && !self->closed) {
         MYDB_BEGIN_ALLOW_THREADS;
         self->db_env->close(self->db_env, 0);
         MYDB_END_ALLOW_THREADS;
@@ -2996,7 +2996,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
         else
             pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
 
-        if (flags & DB_SET_RECNO) /* return key, pkey and data */
+        if (key.data && key.size) /* return key, pkey and data */
         {
             PyObject *keyObj;
             int type = _DB_get_type(self->mydb);