[Python-checkins] r50893 - in python/branches/release24-maint: Lib/bsddb/test/test_basics.py Misc/NEWS Modules/_bsddb.c
gregory.p.smith
python-checkins at python.org
Fri Jul 28 05:16:58 CEST 2006
Author: gregory.p.smith
Date: Fri Jul 28 05:16:53 2006
New Revision: 50893
Modified:
python/branches/release24-maint/Lib/bsddb/test/test_basics.py
python/branches/release24-maint/Misc/NEWS
python/branches/release24-maint/Modules/_bsddb.c
Log:
- pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
methods now allow their database parameter to be None as the
sleepycat API allows.
also adds a testcase.
backport of trunk commit 50889 to 2.4.
Modified: python/branches/release24-maint/Lib/bsddb/test/test_basics.py
==============================================================================
--- python/branches/release24-maint/Lib/bsddb/test/test_basics.py (original)
+++ python/branches/release24-maint/Lib/bsddb/test/test_basics.py Fri Jul 28 05:16:53 2006
@@ -555,6 +555,9 @@
num = d.truncate()
assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,)
+ #----------------------------------------
+
+
#----------------------------------------------------------------------
@@ -576,18 +579,40 @@
dbopenflags = db.DB_THREAD
-class BasicBTreeWithEnvTestCase(BasicTestCase):
- dbtype = db.DB_BTREE
+class BasicWithEnvTestCase(BasicTestCase):
dbopenflags = db.DB_THREAD
useEnv = 1
envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK
+ #----------------------------------------
+
+ def test07_EnvRemoveAndRename(self):
+ if not self.env:
+ return
+
+ if verbose:
+ print '\n', '-=' * 30
+ print "Running %s.test07_EnvRemoveAndRename..." % self.__class__.__name__
+
+ # can't rename or remove an open DB
+ self.d.close()
+
+ newname = self.filename + '.renamed'
+ self.env.dbrename(self.filename, None, newname)
+ self.env.dbremove(newname)
+
+ # dbremove and dbrename are in 4.1 and later
+ if db.version() < (4,1):
+ del test07_EnvRemoveAndRename
+
+ #----------------------------------------
+
+class BasicBTreeWithEnvTestCase(BasicWithEnvTestCase):
+ dbtype = db.DB_BTREE
+
-class BasicHashWithEnvTestCase(BasicTestCase):
+class BasicHashWithEnvTestCase(BasicWithEnvTestCase):
dbtype = db.DB_HASH
- dbopenflags = db.DB_THREAD
- useEnv = 1
- envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK
#----------------------------------------------------------------------
Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS (original)
+++ python/branches/release24-maint/Misc/NEWS Fri Jul 28 05:16:53 2006
@@ -60,6 +60,9 @@
return correct results. It could previously incorrectly return 0 in some
cases. Fixes SF bug 1493322 (pybsddb bug 1184012).
+- pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
+ methods now allow their database parameter to be None as the
+ sleepycat API allows.
Library
-------
Modified: python/branches/release24-maint/Modules/_bsddb.c
==============================================================================
--- python/branches/release24-maint/Modules/_bsddb.c (original)
+++ python/branches/release24-maint/Modules/_bsddb.c Fri Jul 28 05:16:53 2006
@@ -97,7 +97,7 @@
#error "eek! DBVER can't handle minor versions > 9"
#endif
-#define PY_BSDDB_VERSION "4.3.0.2"
+#define PY_BSDDB_VERSION "4.3.0.3"
static char *rcs_id = "$Id$";
@@ -3587,7 +3587,7 @@
DB_TXN *txn = NULL;
char* kwnames[] = { "file", "database", "txn", "flags", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss|Oi:dbremove", kwnames,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zOi:dbremove", kwnames,
&file, &database, &txnobj, &flags)) {
return NULL;
}
@@ -3614,7 +3614,7 @@
DB_TXN *txn = NULL;
char* kwnames[] = { "file", "database", "newname", "txn", "flags", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss|Oi:dbrename", kwnames,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "szs|Oi:dbrename", kwnames,
&file, &database, &newname, &txnobj, &flags)) {
return NULL;
}
More information about the Python-checkins
mailing list