Re: Hi all
[notmuch-archives.git] / 69 / 423e7bfe557ed06a6f6658d39d7efe7d63adeb
1 Return-Path: <schnouki@schnouki.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 830B9429E25\r
6         for <notmuch@notmuchmail.org>; Tue,  6 Dec 2011 02:03:53 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id MXLCrjhsPSSR for <notmuch@notmuchmail.org>;\r
17         Tue,  6 Dec 2011 02:03:52 -0800 (PST)\r
18 Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
19         by olra.theworths.org (Postfix) with ESMTP id C4038431FB6\r
20         for <notmuch@notmuchmail.org>; Tue,  6 Dec 2011 02:03:52 -0800 (PST)\r
21 Received: from thor.loria.fr (thor.loria.fr [152.81.12.250])\r
22         by ks3536.kimsufi.com (Postfix) with ESMTPSA id B74EA6A0026;\r
23         Tue,  6 Dec 2011 11:03:50 +0100 (CET)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
25         s=key-schnouki; t=1323165830;\r
26         bh=KudbbpvWaCRA6GEwS2JgPfV06zJtdCNpVzGiVUMgkj4=;\r
27         h=From:To:Subject:Date:Message-Id;\r
28         b=H1H9k5CA0ZWkUWEOMD3cXQW582larEX9RpQwOxxzLv6DDvkY1ipsZxvC4TfKZPgG+\r
29         tpGnBEVQQjrcBkQUfi7YSWoO/Meeu27CO/KK+RPUu5G3h7WQx7zoBmN7rS7skzgPxy\r
30         xYERFMsfv9yRbEzWSCKf48030MRA6CRHb00Uw/8I=\r
31 From: Thomas Jost <schnouki@schnouki.net>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH] python: use wrapped notmuch_*_t types instead of raw pointers\r
34 Date: Tue,  6 Dec 2011 11:03:22 +0100\r
35 Message-Id: <1323165802-16960-1-git-send-email-schnouki@schnouki.net>\r
36 X-Mailer: git-send-email 1.7.7.4\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Tue, 06 Dec 2011 10:03:53 -0000\r
50 \r
51 Now that types are checked correctly, we also need to make sure that all the\r
52 arguments actually are instances of these types. Otherwise the function calls\r
53 will fail and raise an exception similar to this one:\r
54    ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: expected\r
55    LP_LP_NotmuchMessageS instance instead of pointer to c_void_p\r
56 ---\r
57  bindings/python/notmuch/database.py |    6 +++---\r
58  1 files changed, 3 insertions(+), 3 deletions(-)\r
59 \r
60 diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
61 index 25b4b1b..c24555e 100644\r
62 --- a/bindings/python/notmuch/database.py\r
63 +++ b/bindings/python/notmuch/database.py\r
64 @@ -378,7 +378,7 @@ class Database(object):\r
65                        be added.\r
66          """\r
67          self._assert_db_is_initialized()\r
68 -        msg_p = c_void_p()\r
69 +        msg_p = NotmuchMessageP()\r
70          status = self._add_message(self._db, _str(filename), byref(msg_p))\r
71  \r
72          if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]:\r
73 @@ -446,7 +446,7 @@ class Database(object):\r
74                      the database was not intitialized.\r
75          """\r
76          self._assert_db_is_initialized()\r
77 -        msg_p = c_void_p()\r
78 +        msg_p = NotmuchMessageP()\r
79          status = Database._find_message(self._db, _str(msgid), byref(msg_p))\r
80          if status != STATUS.SUCCESS:\r
81              raise NotmuchError(status)\r
82 @@ -479,7 +479,7 @@ class Database(object):\r
83  \r
84          *Added in notmuch 0.9*"""\r
85          self._assert_db_is_initialized()\r
86 -        msg_p = c_void_p()\r
87 +        msg_p = NotmuchMessageP()\r
88          status = Database._find_message_by_filename(self._db, _str(filename),\r
89                                                      byref(msg_p))\r
90          if status != STATUS.SUCCESS:\r
91 -- \r
92 1.7.7.4\r
93 \r