[PATCH 7/7] python: wrap and use notmuch_database_destroy as destructor

Justus Winter 4winter at informatik.uni-hamburg.de
Tue Mar 20 17:55:11 PDT 2012


Adapt the go bindings to the notmuch_database_close split.

Signed-off-by: Justus Winter <4winter at informatik.uni-hamburg.de>
---
 bindings/python/notmuch/database.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 44d40fd..9a1896b 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -218,9 +218,22 @@ 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)
+
+    _destroy = nmlib.notmuch_database_destroy
+    _destroy.argtypes = [NotmuchDatabaseP]
+    _destroy.restype = None
+
+    def destroy(self):
+        '''
+        Destroys the notmuch database.
+        '''
+        if self._db:
+            self._destroy(self._db)
             self._db = None
 
     def __enter__(self):
-- 
1.7.9.1



More information about the notmuch mailing list