|
97 | 97 | #error "eek! DBVER can't handle minor versions > 9" |
98 | 98 | #endif |
99 | 99 |
|
100 | | -#define PY_BSDDB_VERSION "4.4.0" |
| 100 | +#define PY_BSDDB_VERSION "4.4.1" |
101 | 101 | static char *rcs_id = "$Id$"; |
102 | 102 |
|
103 | 103 |
|
@@ -912,7 +912,7 @@ DBEnv_dealloc(DBEnvObject* self) |
912 | 912 | } |
913 | 913 | #endif |
914 | 914 |
|
915 | | - if (self->db_env) { |
| 915 | + if (self->db_env && !self->closed) { |
916 | 916 | MYDB_BEGIN_ALLOW_THREADS; |
917 | 917 | self->db_env->close(self->db_env, 0); |
918 | 918 | MYDB_END_ALLOW_THREADS; |
@@ -1534,11 +1534,11 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs) |
1534 | 1534 | keyObj = PyInt_FromLong(*(int *)key.data); |
1535 | 1535 | else |
1536 | 1536 | keyObj = PyString_FromStringAndSize(key.data, key.size); |
1537 | | - retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj); |
| 1537 | + retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj); |
1538 | 1538 | } |
1539 | 1539 | else /* return just the pkey and data */ |
1540 | 1540 | { |
1541 | | - retval = Py_BuildValue("OO", pkeyObj, dataObj); |
| 1541 | + retval = PyTuple_Pack(2, pkeyObj, dataObj); |
1542 | 1542 | } |
1543 | 1543 | FREE_DBT(pkey); |
1544 | 1544 | FREE_DBT(data); |
@@ -3176,20 +3176,20 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) |
3176 | 3176 | else |
3177 | 3177 | pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); |
3178 | 3178 |
|
3179 | | - if (flags & DB_SET_RECNO) /* return key, pkey and data */ |
| 3179 | + if (key.data && key.size) /* return key, pkey and data */ |
3180 | 3180 | { |
3181 | 3181 | PyObject *keyObj; |
3182 | 3182 | int type = _DB_get_type(self->mydb); |
3183 | 3183 | if (type == DB_RECNO || type == DB_QUEUE) |
3184 | 3184 | keyObj = PyInt_FromLong(*(int *)key.data); |
3185 | 3185 | else |
3186 | 3186 | keyObj = PyString_FromStringAndSize(key.data, key.size); |
3187 | | - retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj); |
| 3187 | + retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj); |
3188 | 3188 | FREE_DBT(key); |
3189 | 3189 | } |
3190 | 3190 | else /* return just the pkey and data */ |
3191 | 3191 | { |
3192 | | - retval = Py_BuildValue("OO", pkeyObj, dataObj); |
| 3192 | + retval = PyTuple_Pack(2, pkeyObj, dataObj); |
3193 | 3193 | } |
3194 | 3194 | FREE_DBT(pkey); |
3195 | 3195 | FREE_DBT(data); |
|
0 commit comments