mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
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.
This commit is contained in:
parent
ec2f74f4b1
commit
4e414d8386
1 changed files with 7 additions and 7 deletions
|
@ -97,7 +97,7 @@
|
||||||
#error "eek! DBVER can't handle minor versions > 9"
|
#error "eek! DBVER can't handle minor versions > 9"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PY_BSDDB_VERSION "4.4.0"
|
#define PY_BSDDB_VERSION "4.4.1"
|
||||||
static char *rcs_id = "$Id$";
|
static char *rcs_id = "$Id$";
|
||||||
|
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ DBEnv_dealloc(DBEnvObject* self)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (self->db_env) {
|
if (self->db_env && !self->closed) {
|
||||||
MYDB_BEGIN_ALLOW_THREADS;
|
MYDB_BEGIN_ALLOW_THREADS;
|
||||||
self->db_env->close(self->db_env, 0);
|
self->db_env->close(self->db_env, 0);
|
||||||
MYDB_END_ALLOW_THREADS;
|
MYDB_END_ALLOW_THREADS;
|
||||||
|
@ -1534,11 +1534,11 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
|
||||||
keyObj = PyInt_FromLong(*(int *)key.data);
|
keyObj = PyInt_FromLong(*(int *)key.data);
|
||||||
else
|
else
|
||||||
keyObj = PyString_FromStringAndSize(key.data, key.size);
|
keyObj = PyString_FromStringAndSize(key.data, key.size);
|
||||||
retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
|
retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
|
||||||
}
|
}
|
||||||
else /* return just the pkey and data */
|
else /* return just the pkey and data */
|
||||||
{
|
{
|
||||||
retval = Py_BuildValue("OO", pkeyObj, dataObj);
|
retval = PyTuple_Pack(2, pkeyObj, dataObj);
|
||||||
}
|
}
|
||||||
FREE_DBT(pkey);
|
FREE_DBT(pkey);
|
||||||
FREE_DBT(data);
|
FREE_DBT(data);
|
||||||
|
@ -3176,7 +3176,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
||||||
else
|
else
|
||||||
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
|
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;
|
PyObject *keyObj;
|
||||||
int type = _DB_get_type(self->mydb);
|
int type = _DB_get_type(self->mydb);
|
||||||
|
@ -3184,12 +3184,12 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
||||||
keyObj = PyInt_FromLong(*(int *)key.data);
|
keyObj = PyInt_FromLong(*(int *)key.data);
|
||||||
else
|
else
|
||||||
keyObj = PyString_FromStringAndSize(key.data, key.size);
|
keyObj = PyString_FromStringAndSize(key.data, key.size);
|
||||||
retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
|
retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
|
||||||
FREE_DBT(key);
|
FREE_DBT(key);
|
||||||
}
|
}
|
||||||
else /* return just the pkey and data */
|
else /* return just the pkey and data */
|
||||||
{
|
{
|
||||||
retval = Py_BuildValue("OO", pkeyObj, dataObj);
|
retval = PyTuple_Pack(2, pkeyObj, dataObj);
|
||||||
}
|
}
|
||||||
FREE_DBT(pkey);
|
FREE_DBT(pkey);
|
||||||
FREE_DBT(data);
|
FREE_DBT(data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue