From c92a5670e3d60decbc13bd8680de37184bc12815 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 Jul 2012 19:43:15 +1000 Subject: pytdb: Check if the database is closed before we touch it If .close() has already been called, we have to play dead - the self->ctx is just not valid any more, as we have been shut down to allow some other part of Samba to open the tdb. Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Mon Jul 16 13:51:52 CEST 2012 on sn-devel-104 --- lib/tdb/python/tests/simple.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/tdb/python/tests') diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py index c37ef83a61..7e295a8c95 100644 --- a/lib/tdb/python/tests/simple.py +++ b/lib/tdb/python/tests/simple.py @@ -33,6 +33,11 @@ class CloseTdbTests(TestCase): self.tdb.close() self.tdb.close() + # Check that further operations do not crash python + self.assertRaises(RuntimeError, lambda: self.tdb.transaction_start()) + + self.assertRaises(RuntimeError, lambda: self.tdb["bar"]) + class InternalTdbTests(TestCase): -- cgit