From ca3939cd52664cce10283cb47b360f1df1552fa0 Mon Sep 17 00:00:00 2001 From: Jesus Cea Date: Thu, 22 May 2008 15:27:38 +0000 Subject: [PATCH] bsddb module updated to version 4.7.0 --- Lib/bsddb/db.py | 2 +- Lib/bsddb/dbtables.py | 4 +- Lib/bsddb/test/test_sequence.py | 2 +- Misc/NEWS | 3 +- Modules/_bsddb.c | 89 +++++++++++++++++++++++++++++++-- Modules/bsddb.h | 2 +- 6 files changed, 91 insertions(+), 11 deletions(-) diff --git a/Lib/bsddb/db.py b/Lib/bsddb/db.py index 3bd0c8ba4e..57bb46e416 100644 --- a/Lib/bsddb/db.py +++ b/Lib/bsddb/db.py @@ -48,4 +48,4 @@ else: from _bsddb import __version__ if version() < (3, 2, 0): - raise ImportError, "correct BerkeleyDB symbols not found. Perhaps python was statically linked with an older version?" + raise ImportError, "correct Berkeley DB symbols not found. Perhaps python was statically linked with an older version?" diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py index babe97c5fd..27028d37f9 100644 --- a/Lib/bsddb/dbtables.py +++ b/Lib/bsddb/dbtables.py @@ -13,7 +13,7 @@ # -- Gregory P. Smith # This provides a simple database table interface built on top of -# the Python BerkeleyDB 3 interface. +# the Python Berkeley DB 3 interface. # _cvsid = '$Id$' @@ -139,7 +139,7 @@ class bsdTableDB : recover=0, dbflags=0): """bsdTableDB(filename, dbhome, create=0, truncate=0, mode=0600) - Open database name in the dbhome BerkeleyDB directory. + Open database name in the dbhome Berkeley DB directory. Use keyword arguments when calling this constructor. """ self.db = None diff --git a/Lib/bsddb/test/test_sequence.py b/Lib/bsddb/test/test_sequence.py index 31754eb5a6..dba1c6e5c8 100644 --- a/Lib/bsddb/test/test_sequence.py +++ b/Lib/bsddb/test/test_sequence.py @@ -110,7 +110,7 @@ class DBSequenceTest(unittest.TestCase): self.assertRaises(db.DBNotFoundError, seq.open, key='id', txn=None, flags=0) - self.assertRaises(db.DBNotFoundError, seq.stat) + self.assertRaises(db.DBInvalidArgError, seq.stat) d.close() diff --git a/Misc/NEWS b/Misc/NEWS index d2becb02d4..b7b8685faf 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,7 +44,8 @@ Extension Modules - Support for Windows 9x has been removed from the winsound module. -- bsddb module updated to version 4.6.4. +- bsddb module updated to version 4.7.0. + http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.0 - Issue #2858: Fix potential memory corruption when bsddb.db.DBEnv.lock_get and other bsddb.db object constructors diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index f5e9566430..e2929ca7db 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -50,7 +50,7 @@ * * Gregory P. Smith was once again the maintainer. * - * Since January 2008, new maintainer is Jesus Cea . + * Since January 2008, new maintainer is Jesus Cea . * Jesus Cea licenses this code to PSF under a Contributor Agreement. * * Use the pybsddb-users@lists.sf.net mailing list for all questions. @@ -4129,6 +4129,26 @@ DBEnv_set_flags(DBEnvObject* self, PyObject* args) } +#if (DBVER >= 47) +static PyObject* +DBEnv_log_set_config(DBEnvObject* self, PyObject* args) +{ + int err, flags, onoff; + + if (!PyArg_ParseTuple(args, "ii:log_set_config", + &flags, &onoff)) + return NULL; + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->log_set_config(self->db_env, flags, onoff); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif /* DBVER >= 47 */ + + static PyObject* DBEnv_set_data_dir(DBEnvObject* self, PyObject* args) { @@ -4779,8 +4799,13 @@ DBEnv_lock_stat(DBEnvObject* self, PyObject* args) MAKE_ENTRY(objs_nowait); MAKE_ENTRY(lockers_wait); MAKE_ENTRY(lockers_nowait); +#if (DBVER >= 47) + MAKE_ENTRY(lock_wait); + MAKE_ENTRY(lock_nowait); +#else MAKE_ENTRY(locks_wait); MAKE_ENTRY(locks_nowait); +#endif MAKE_ENTRY(hash_len); #endif MAKE_ENTRY(regsize); @@ -4943,6 +4968,30 @@ DBEnv_set_get_returns_none(DBEnvObject* self, PyObject* args) return PyInt_FromLong(oldValue); } +#if (DBVER >= 40) +static PyObject* +DBEnv_set_rpc_server(DBEnvObject* self, PyObject* args, PyObject* kwargs) +{ + int err; + char *host; + long cl_timeout=0, sv_timeout=0; + + static char* kwnames[] = { "host", "cl_timeout", "sv_timeout", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ll:set_rpc_server", kwnames, + &host, &cl_timeout, &sv_timeout)) + return NULL; + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->set_rpc_server(self->db_env, NULL, host, cl_timeout, + sv_timeout, 0); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif + #if (DBVER >= 40) static PyObject* DBEnv_set_verbose(DBEnvObject* self, PyObject* args) @@ -5075,7 +5124,11 @@ static PyObject* DBEnv_rep_get_nsites(DBEnvObject* self, PyObject* args) { int err; +#if (DBVER >= 47) + u_int32_t nsites; +#else int nsites; +#endif if (!PyArg_ParseTuple(args, ":rep_get_nsites")) { return NULL; @@ -5109,7 +5162,11 @@ static PyObject* DBEnv_rep_get_priority(DBEnvObject* self, PyObject* args) { int err; +#if (DBVER >= 47) + u_int32_t priority; +#else int priority; +#endif if (!PyArg_ParseTuple(args, ":rep_get_priority")) { return NULL; @@ -6094,6 +6151,9 @@ static PyMethodDef DBEnv_methods[] = { {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS}, +#if (DBVER >= 47) + {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS}, +#endif {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS}, {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS}, {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS}, @@ -6139,6 +6199,10 @@ static PyMethodDef DBEnv_methods[] = { #if (DBVER >= 40) {"txn_recover", (PyCFunction)DBEnv_txn_recover, METH_VARARGS}, #endif +#if (DBVER >= 40) + {"set_rpc_server", (PyCFunction)DBEnv_set_rpc_server, + METH_VARARGS||METH_KEYWORDS}, +#endif #if (DBVER >= 40) {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS}, #if (DBVER >= 42) @@ -6760,6 +6824,7 @@ DL_EXPORT(void) init_bsddb(void) #if (DBVER < 45) ADD_INT(d, DB_CACHED_COUNTS); #endif + #if (DBVER >= 41) _addIntToDict(d, "DB_CHECKPOINT", 0); #else @@ -6858,14 +6923,25 @@ DL_EXPORT(void) init_bsddb(void) ADD_INT(d, DB_TIME_NOTGRANTED); ADD_INT(d, DB_TXN_NOT_DURABLE); ADD_INT(d, DB_TXN_WRITE_NOSYNC); - ADD_INT(d, DB_LOG_AUTOREMOVE); - ADD_INT(d, DB_DIRECT_LOG); ADD_INT(d, DB_DIRECT_DB); ADD_INT(d, DB_INIT_REP); ADD_INT(d, DB_ENCRYPT); ADD_INT(d, DB_CHKSUM); #endif +#if (DBVER >= 42) && (DBVER < 47) + ADD_INT(d, DB_LOG_AUTOREMOVE); + ADD_INT(d, DB_DIRECT_LOG); +#endif + +#if (DBVER >= 47) + ADD_INT(d, DB_LOG_DIRECT); + ADD_INT(d, DB_LOG_DSYNC); + ADD_INT(d, DB_LOG_IN_MEMORY); + ADD_INT(d, DB_LOG_AUTO_REMOVE); + ADD_INT(d, DB_LOG_ZERO); +#endif + #if (DBVER >= 44) ADD_INT(d, DB_DSYNC_DB); #endif @@ -6935,14 +7011,17 @@ DL_EXPORT(void) init_bsddb(void) #endif #if (DBVER >= 43) - ADD_INT(d, DB_DSYNC_LOG); - ADD_INT(d, DB_LOG_INMEMORY); ADD_INT(d, DB_BUFFER_SMALL); ADD_INT(d, DB_SEQ_DEC); ADD_INT(d, DB_SEQ_INC); ADD_INT(d, DB_SEQ_WRAP); #endif +#if (DBVER >= 43) && (DBVER < 47) + ADD_INT(d, DB_LOG_INMEMORY); + ADD_INT(d, DB_DSYNC_LOG); +#endif + #if (DBVER >= 41) ADD_INT(d, DB_ENCRYPT_AES); ADD_INT(d, DB_AUTO_COMMIT); diff --git a/Modules/bsddb.h b/Modules/bsddb.h index 48444b582a..8d3e1d6399 100644 --- a/Modules/bsddb.h +++ b/Modules/bsddb.h @@ -105,7 +105,7 @@ #error "eek! DBVER can't handle minor versions > 9" #endif -#define PY_BSDDB_VERSION "4.6.5devel2" +#define PY_BSDDB_VERSION "4.7.0" /* Python object definitions */ -- 2.40.0