diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-11-23 11:26:07 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-11-23 11:26:07 (GMT) |
commit | b2c7affbaab984915b9401105334afffeedf706d (patch) | |
tree | 0ba16241339e317dd0dc2ecbd65abaa6a9f8f40e /Modules | |
parent | a797d8150dd6fd8336653d8e91db3c088f2c53ff (diff) | |
download | cpython-b2c7affbaab984915b9401105334afffeedf706d.zip cpython-b2c7affbaab984915b9401105334afffeedf706d.tar.gz cpython-b2c7affbaab984915b9401105334afffeedf706d.tar.bz2 |
Merge with bsddb3 2002.11.23.10.42.36
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_bsddb.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index f3afdc9..5834d51 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -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; |