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 830B9429E25 for ; Tue, 6 Dec 2011 02:03:53 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] 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 MXLCrjhsPSSR for ; Tue, 6 Dec 2011 02:03:52 -0800 (PST) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id C4038431FB6 for ; Tue, 6 Dec 2011 02:03:52 -0800 (PST) Received: from thor.loria.fr (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id B74EA6A0026; Tue, 6 Dec 2011 11:03:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1323165830; bh=KudbbpvWaCRA6GEwS2JgPfV06zJtdCNpVzGiVUMgkj4=; h=From:To:Subject:Date:Message-Id; b=H1H9k5CA0ZWkUWEOMD3cXQW582larEX9RpQwOxxzLv6DDvkY1ipsZxvC4TfKZPgG+ tpGnBEVQQjrcBkQUfi7YSWoO/Meeu27CO/KK+RPUu5G3h7WQx7zoBmN7rS7skzgPxy xYERFMsfv9yRbEzWSCKf48030MRA6CRHb00Uw/8I= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH] python: use wrapped notmuch_*_t types instead of raw pointers Date: Tue, 6 Dec 2011 11:03:22 +0100 Message-Id: <1323165802-16960-1-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.7.4 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: Tue, 06 Dec 2011 10:03:53 -0000 Now that types are checked correctly, we also need to make sure that all the arguments actually are instances of these types. Otherwise the function calls will fail and raise an exception similar to this one: ctypes.ArgumentError: argument 3: : expected LP_LP_NotmuchMessageS instance instead of pointer to c_void_p --- bindings/python/notmuch/database.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 25b4b1b..c24555e 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -378,7 +378,7 @@ class Database(object): be added. """ self._assert_db_is_initialized() - msg_p = c_void_p() + msg_p = NotmuchMessageP() status = self._add_message(self._db, _str(filename), byref(msg_p)) if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]: @@ -446,7 +446,7 @@ class Database(object): the database was not intitialized. """ self._assert_db_is_initialized() - msg_p = c_void_p() + msg_p = NotmuchMessageP() status = Database._find_message(self._db, _str(msgid), byref(msg_p)) if status != STATUS.SUCCESS: raise NotmuchError(status) @@ -479,7 +479,7 @@ class Database(object): *Added in notmuch 0.9*""" self._assert_db_is_initialized() - msg_p = c_void_p() + msg_p = NotmuchMessageP() status = Database._find_message_by_filename(self._db, _str(filename), byref(msg_p)) if status != STATUS.SUCCESS: -- 1.7.7.4