diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py index c5579de75cf..b7134966d72 100644 --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -1000,11 +1000,12 @@ class CrashAndBurn(unittest.TestCase) : # # See http://bugs.python.org/issue3307 # self.assertRaises(db.DBInvalidArgError, db.DB, None, 65535) - def test02_DBEnv_dealloc(self): - # http://bugs.python.org/issue3885 - import gc - self.assertRaises(db.DBInvalidArgError, db.DBEnv, ~db.DB_RPCCLIENT) - gc.collect() + if db.version() < (4, 8) : + def test02_DBEnv_dealloc(self): + # http://bugs.python.org/issue3885 + import gc + self.assertRaises(db.DBInvalidArgError, db.DBEnv, ~db.DB_RPCCLIENT) + gc.collect() #---------------------------------------------------------------------- diff --git a/Lib/bsddb/test/test_distributed_transactions.py b/Lib/bsddb/test/test_distributed_transactions.py index f864b883362..c6243a22afe 100644 --- a/Lib/bsddb/test/test_distributed_transactions.py +++ b/Lib/bsddb/test/test_distributed_transactions.py @@ -35,7 +35,7 @@ class DBTxn_distributed(unittest.TestCase): db.DB_INIT_TXN | db.DB_INIT_LOG | db.DB_INIT_MPOOL | db.DB_INIT_LOCK, 0666) self.db = db.DB(self.dbenv) - self.db.set_re_len(db.DB_XIDDATASIZE) + self.db.set_re_len(db.DB_GID_SIZE) if must_open_db : if db.version() > (4,1) : txn=self.dbenv.txn_begin() @@ -76,7 +76,7 @@ class DBTxn_distributed(unittest.TestCase): # let them be garbage collected. for i in xrange(self.num_txns) : txn = self.dbenv.txn_begin() - gid = "%%%dd" %db.DB_XIDDATASIZE + gid = "%%%dd" %db.DB_GID_SIZE gid = adapt(gid %i) self.db.put(i, gid, txn=txn, flags=db.DB_APPEND) txns.add(gid) diff --git a/Misc/NEWS b/Misc/NEWS index 3f369eda6fe..eb5b5da4e9b 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -45,6 +45,8 @@ Library Extension Modules ----------------- +- Issue #6949: Allow the _bsddb extension to be built with db-4.8.x. + - Issue #8142: Update libffi to the 3.0.9 release. - Issue #1530559: When passing a non-integer argument to struct.pack with *any* diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 5aedfca8dec..9ae8e52b061 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -215,6 +215,10 @@ static PyObject* DBRepUnavailError; /* DB_REP_UNAVAIL */ #define DB_BUFFER_SMALL ENOMEM #endif +#if (DBVER < 48) +#define DB_GID_SIZE DB_XIDDATASIZE +#endif + /* --------------------------------------------------------------------- */ /* Structure definitions */ @@ -4501,7 +4505,11 @@ DBEnv_txn_recover(DBEnvObject* self) DBTxnObject *txn; #define PREPLIST_LEN 16 DB_PREPLIST preplist[PREPLIST_LEN]; +#if (DBVER < 48) long retp; +#else + u_int32_t retp; +#endif CHECK_ENV_NOT_CLOSED(self); @@ -4522,7 +4530,7 @@ DBEnv_txn_recover(DBEnvObject* self) flags=DB_NEXT; /* Prepare for next loop pass */ for (i=0; i= 42) {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, @@ -7091,6 +7103,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ ADD_INT(d, DB_MAX_PAGES); ADD_INT(d, DB_MAX_RECORDS); +#if (DBVER < 48) #if (DBVER >= 42) ADD_INT(d, DB_RPCCLIENT); #else @@ -7098,7 +7111,11 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */ _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT); #endif +#endif + +#if (DBVER < 48) ADD_INT(d, DB_XA_CREATE); +#endif ADD_INT(d, DB_CREATE); ADD_INT(d, DB_NOMMAP); @@ -7115,7 +7132,13 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ ADD_INT(d, DB_INIT_TXN); ADD_INT(d, DB_JOINENV); +#if (DBVER >= 48) + ADD_INT(d, DB_GID_SIZE); +#else ADD_INT(d, DB_XIDDATASIZE); + /* Allow new code to work in old BDB releases */ + _addIntToDict(d, "DB_GID_SIZE", DB_XIDDATASIZE); +#endif ADD_INT(d, DB_RECOVER); ADD_INT(d, DB_RECOVER_FATAL); diff --git a/setup.py b/setup.py index a86ae1c743e..fa92d053e15 100644 --- a/setup.py +++ b/setup.py @@ -707,7 +707,7 @@ class PyBuildExt(build_ext): # a release. Most open source OSes come with one or more # versions of BerkeleyDB already installed. - max_db_ver = (4, 7) + max_db_ver = (4, 8) min_db_ver = (3, 3) db_setup_debug = False # verbose debug prints from this script?