X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fdatabase.py;h=0ac8b06a35f15c1965e3cf1e8d6c1bab7a3909c3;hb=1f08664a6b8f7cba63f63855833f877b66bbbe05;hp=44d40fdb322acc4ac2af5686e01ea856212f97b2;hpb=a7561cc20b17669784c3259afcbcef98029f93e9;p=obsolete%2Fnotmuch-old
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 44d40fdb..0ac8b06a 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -14,7 +14,7 @@ for more details.
You should have received a copy of the GNU General Public License
along with notmuch. If not, see .
-Copyright 2010 Sebastian Spaeth '
+Copyright 2010 Sebastian Spaeth
"""
import os
@@ -161,8 +161,13 @@ class Database(object):
else:
self.create(path)
+ _destroy = nmlib.notmuch_database_destroy
+ _destroy.argtypes = [NotmuchDatabaseP]
+ _destroy.restype = None
+
def __del__(self):
- self.close()
+ if self._db:
+ self._destroy(self._db)
def _assert_db_is_initialized(self):
"""Raises :exc:`NotInitializedError` if self._db is `None`"""
@@ -218,10 +223,11 @@ class Database(object):
_close.restype = None
def close(self):
- """Close and free the notmuch database if needed"""
- if self._db is not None:
+ '''
+ Closes the notmuch database.
+ '''
+ if self._db:
self._close(self._db)
- self._db = None
def __enter__(self):
'''