summaryrefslogtreecommitdiff
path: root/lib/tdb/python
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-07-16 19:43:15 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-07-16 13:51:51 +0200
commitc92a5670e3d60decbc13bd8680de37184bc12815 (patch)
tree5d0987b2c12caba6235cd55c35f87cde0c784ad8 /lib/tdb/python
parenta8e88332a394f4a4c3e43b496738008fba39d39f (diff)
downloadsamba-c92a5670e3d60decbc13bd8680de37184bc12815.tar.gz
samba-c92a5670e3d60decbc13bd8680de37184bc12815.tar.bz2
samba-c92a5670e3d60decbc13bd8680de37184bc12815.zip
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 <abartlet@samba.org> Autobuild-Date(master): Mon Jul 16 13:51:52 CEST 2012 on sn-devel-104
Diffstat (limited to 'lib/tdb/python')
-rw-r--r--lib/tdb/python/tests/simple.py5
1 files changed, 5 insertions, 0 deletions
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):