The branch, master has been updated via 5cdef70 subunithelper: Remove accidentally added line. via ab37c48 pytdb: Check errors after PyObject_New() calls via bdd6bef pytdb: Add support for tdb_repack() via a291428 pytdb: Add TDB_INCOMPATIBLE_HASH open flag from 14efa95 subunithelper: Fix format time.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 5cdef708230bfca19d552ffe5476fe9fcdf850c6 Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Oct 2 23:32:12 2010 +0200 subunithelper: Remove accidentally added line. commit ab37c48e57a16f69c6b926dbed6d4c1a50bb3fb9 Author: Kirill Smelkov <k...@landau.phys.spbu.ru> Date: Sat Oct 2 17:43:50 2010 +0400 pytdb: Check errors after PyObject_New() calls The call could fail with e.g. MemoryError, and we'll dereference NULL pointer without checking. Signed-off-by: Kirill Smelkov <k...@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jel...@samba.org> commit bdd6bef5dd839ca6fb2d610b84098d2026bb6db1 Author: Kirill Smelkov <k...@mns.spb.ru> Date: Sat Oct 2 17:43:46 2010 +0400 pytdb: Add support for tdb_repack() Cc: 597...@bugs.debian.org Signed-off-by: Kirill Smelkov <k...@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jel...@samba.org> commit a29142855e3f47a86a07c520a92f73c14e2488d7 Author: Kirill Smelkov <k...@mns.spb.ru> Date: Sat Oct 2 17:43:40 2010 +0400 pytdb: Add TDB_INCOMPATIBLE_HASH open flag In 2dcf76 Rusty added TDB_INCOMPATIBLE_HASH open flag which selects Jenkins lookup3 hash for new databases. Expose this flag to python users too. Cc: Rusty Russell <ru...@rustcorp.com.au> Signed-off-by: Kirill Smelkov <k...@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jel...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/tdb/pytdb.c | 17 +++++++++++++++++ lib/tdb/python/tests/simple.py | 6 ++++++ selftest/subunithelper.py | 3 --- 3 files changed, 23 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c index f2638db..0090633 100644 --- a/lib/tdb/pytdb.c +++ b/lib/tdb/pytdb.c @@ -97,6 +97,11 @@ static PyObject *py_tdb_open(PyTypeObject *type, PyObject *args, PyObject *kwarg } ret = PyObject_New(PyTdbObject, &PyTdb); + if (!ret) { + tdb_close(ctx); + return NULL; + } + ret->ctx = ctx; ret->closed = false; return (PyObject *)ret; @@ -330,6 +335,8 @@ static PyObject *tdb_object_iter(PyTdbObject *self) PyTdbIteratorObject *ret; ret = PyObject_New(PyTdbIteratorObject, &PyTdbIterator); + if (!ret) + return NULL; ret->current = tdb_firstkey(self->ctx); ret->iteratee = self; Py_INCREF(self); @@ -343,6 +350,13 @@ static PyObject *obj_clear(PyTdbObject *self) Py_RETURN_NONE; } +static PyObject *obj_repack(PyTdbObject *self) +{ + int ret = tdb_repack(self->ctx); + PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); + Py_RETURN_NONE; +} + static PyObject *obj_enable_seqnum(PyTdbObject *self) { tdb_enable_seqnum(self->ctx); @@ -393,6 +407,8 @@ static PyMethodDef tdb_object_methods[] = { { "iterkeys", (PyCFunction)tdb_object_iter, METH_NOARGS, "S.iterkeys() -> iterator" }, { "clear", (PyCFunction)obj_clear, METH_NOARGS, "S.clear() -> None\n" "Wipe the entire database." }, + { "repack", (PyCFunction)obj_repack, METH_NOARGS, "S.repack() -> None\n" + "Repack the entire database." }, { "enable_seqnum", (PyCFunction)obj_enable_seqnum, METH_NOARGS, "S.enable_seqnum() -> None" }, { "increment_seqnum_nonblock", (PyCFunction)obj_increment_seqnum_nonblock, METH_NOARGS, @@ -572,6 +588,7 @@ void inittdb(void) PyModule_AddObject(m, "VOLATILE", PyInt_FromLong(TDB_VOLATILE)); PyModule_AddObject(m, "ALLOW_NESTING", PyInt_FromLong(TDB_ALLOW_NESTING)); PyModule_AddObject(m, "DISALLOW_NESTING", PyInt_FromLong(TDB_DISALLOW_NESTING)); + PyModule_AddObject(m, "INCOMPATIBLE_HASH", PyInt_FromLong(TDB_INCOMPATIBLE_HASH)); PyModule_AddObject(m, "__docformat__", PyString_FromString("restructuredText")); diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py index 18180e1..6386a28 100644 --- a/lib/tdb/python/tests/simple.py +++ b/lib/tdb/python/tests/simple.py @@ -142,6 +142,12 @@ class SimpleTdbTests(TestCase): self.tdb.clear() self.assertEquals(0, len(list(self.tdb))) + def test_repack(self): + self.tdb["foo"] = "abc" + self.tdb["bar"] = "def" + del self.tdb["foo"] + self.tdb.repack() + def test_seqnum(self): self.tdb.enable_seqnum() seq1 = self.tdb.seqnum diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index 872989e..13b0580 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -552,6 +552,3 @@ class PlainFormatter(TestsuiteEnabledTestResult): self.skips.setdefault(reason, []).append(name) if self.totalsuites: self.totalsuites-=1 - - -class TestProtocolServer(subunit.TestProtocolServer): -- Samba Shared Repository