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

Skip to content

Commit 4e414d8

Browse files
committed
commits sourceforge patch #1407992 by neil.norwitz.
this fixes the bsddb db associate tests when compiled against BerkeleyDB 3.3 thru 4.1. 4.2 thru 4.4 already passed and still pass.
1 parent ec2f74f commit 4e414d8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Modules/_bsddb.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
#error "eek! DBVER can't handle minor versions > 9"
9898
#endif
9999

100-
#define PY_BSDDB_VERSION "4.4.0"
100+
#define PY_BSDDB_VERSION "4.4.1"
101101
static char *rcs_id = "$Id$";
102102

103103

@@ -912,7 +912,7 @@ DBEnv_dealloc(DBEnvObject* self)
912912
}
913913
#endif
914914

915-
if (self->db_env) {
915+
if (self->db_env && !self->closed) {
916916
MYDB_BEGIN_ALLOW_THREADS;
917917
self->db_env->close(self->db_env, 0);
918918
MYDB_END_ALLOW_THREADS;
@@ -1534,11 +1534,11 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
15341534
keyObj = PyInt_FromLong(*(int *)key.data);
15351535
else
15361536
keyObj = PyString_FromStringAndSize(key.data, key.size);
1537-
retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
1537+
retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
15381538
}
15391539
else /* return just the pkey and data */
15401540
{
1541-
retval = Py_BuildValue("OO", pkeyObj, dataObj);
1541+
retval = PyTuple_Pack(2, pkeyObj, dataObj);
15421542
}
15431543
FREE_DBT(pkey);
15441544
FREE_DBT(data);
@@ -3176,20 +3176,20 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
31763176
else
31773177
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
31783178

3179-
if (flags & DB_SET_RECNO) /* return key, pkey and data */
3179+
if (key.data && key.size) /* return key, pkey and data */
31803180
{
31813181
PyObject *keyObj;
31823182
int type = _DB_get_type(self->mydb);
31833183
if (type == DB_RECNO || type == DB_QUEUE)
31843184
keyObj = PyInt_FromLong(*(int *)key.data);
31853185
else
31863186
keyObj = PyString_FromStringAndSize(key.data, key.size);
3187-
retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
3187+
retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
31883188
FREE_DBT(key);
31893189
}
31903190
else /* return just the pkey and data */
31913191
{
3192-
retval = Py_BuildValue("OO", pkeyObj, dataObj);
3192+
retval = PyTuple_Pack(2, pkeyObj, dataObj);
31933193
}
31943194
FREE_DBT(pkey);
31953195
FREE_DBT(data);

0 commit comments

Comments
 (0)