Merge with bsddb3 2002.11.23.10.42.36

This commit is contained in:
Martin v. Löwis 2002-11-23 11:26:07 +00:00
parent a797d8150d
commit b2c7affbaa
6 changed files with 100 additions and 47 deletions

View file

@ -75,12 +75,12 @@
/* --------------------------------------------------------------------- */
/* Various macro definitions */
#define PY_BSDDB_VERSION "3.4.0"
#define PY_BSDDB_VERSION "3.4.2"
/* 40 = 4.0, 33 = 3.3; this will break if the second number is > 9 */
#define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR)
static char *orig_rcs_id = "/Id: _db.c,v 1.44 2002/06/07 18:24:00 greg Exp /";
static char *orig_rcs_id = "/Id: _db.c,v 1.48 2002/11/21 19:11:19 greg Exp /";
static char *rcs_id = "$Id$";
@ -1012,7 +1012,17 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
secondaryDB->associateCallback = callback;
secondaryDB->primaryDBType = _DB_get_type(self);
/* PyEval_InitThreads is called here due to a quirk in python 1.5
* - 2.2.1 (at least) according to Russell Williamson <merel@wt.net>:
* The global interepreter lock is not initialized until the first
* thread is created using thread.start_new_thread() or fork() is
* called. that would cause the ALLOW_THREADS here to segfault due
* to a null pointer reference if no threads or child processes
* have been created. This works around that and is a no-op if
* threads have already been initialized.
* (see pybsddb-users mailing list post on 2002-08-07)
*/
PyEval_InitThreads();
MYDB_BEGIN_ALLOW_THREADS;
err = self->db->associate(self->db,
secondaryDB->db,
@ -2323,8 +2333,6 @@ DBC_close(DBCursorObject* self, PyObject* args)
if (!PyArg_ParseTuple(args, ":close"))
return NULL;
CHECK_CURSOR_NOT_CLOSED(self);
if (self->dbc != NULL) {
MYDB_BEGIN_ALLOW_THREADS;
err = self->dbc->c_close(self->dbc);
@ -2413,7 +2421,7 @@ DBC_first(DBCursorObject* self, PyObject* args, PyObject* kwargs)
static PyObject*
DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs)
{
int err, flags;
int err, flags=0;
PyObject* keyobj = NULL;
PyObject* dataobj = NULL;
PyObject* retval = NULL;
@ -3298,7 +3306,7 @@ DBEnv_lock_stat(DBEnvObject* self, PyObject* args)
int err;
DB_LOCK_STAT* sp;
PyObject* d = NULL;
u_int32_t flags;
u_int32_t flags = 0;
if (!PyArg_ParseTuple(args, "|i:lock_stat", &flags))
return NULL;
@ -3410,7 +3418,7 @@ DBEnv_txn_stat(DBEnvObject* self, PyObject* args)
int err;
DB_TXN_STAT* sp;
PyObject* d = NULL;
u_int32_t flags;
u_int32_t flags=0;
if (!PyArg_ParseTuple(args, "|i:txn_stat", &flags))
return NULL;