From c2fa7ea2d7fa3938745b79f7fdae5f563eef3e92 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 21 Mar 2012 01:55:11 +0100 Subject: [PATCH] [PATCH 7/7] python: wrap and use notmuch_database_destroy as destructor --- cd/379effc341e8ad5670a60c3c44a4f06630d49a | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 cd/379effc341e8ad5670a60c3c44a4f06630d49a diff --git a/cd/379effc341e8ad5670a60c3c44a4f06630d49a b/cd/379effc341e8ad5670a60c3c44a4f06630d49a new file mode 100644 index 000000000..bb6d891d0 --- /dev/null +++ b/cd/379effc341e8ad5670a60c3c44a4f06630d49a @@ -0,0 +1,101 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 4728B431FD7 + for ; Tue, 20 Mar 2012 17:55:45 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id hAjFiVZWdT4U for ; + Tue, 20 Mar 2012 17:55:44 -0700 (PDT) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 64FC5431FCF + for ; Tue, 20 Mar 2012 17:55:44 -0700 (PDT) +Received: from mail.jade-hamburg.de (unknown [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id 05BA357678D + for ; Wed, 21 Mar 2012 01:55:43 +0100 (CET) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id 67E93DF2A3; Wed, 21 Mar 2012 01:55:42 +0100 (CET) +Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.153]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id 8E887DF2A7; + Wed, 21 Mar 2012 01:55:27 +0100 (CET) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) + (envelope-from ) + id 1SA9pl-0007vP-IX; Wed, 21 Mar 2012 01:55:25 +0100 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +To: notmuch@notmuchmail.org +Subject: [PATCH 7/7] python: wrap and use notmuch_database_destroy as + destructor +Date: Wed, 21 Mar 2012 01:55:11 +0100 +Message-Id: + <1332291311-28954-8-git-send-email-4winter@informatik.uni-hamburg.de> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: + <1332291311-28954-1-git-send-email-4winter@informatik.uni-hamburg.de> +References: + <1332291311-28954-1-git-send-email-4winter@informatik.uni-hamburg.de> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 21 Mar 2012 00:55:45 -0000 + +Adapt the go bindings to the notmuch_database_close split. + +Signed-off-by: Justus Winter <4winter@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 + -- 2.26.2