[PATCH] properly raise exceptions in python bindings
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Sun, 25 Sep 2011 21:07:35 +0000 (23:07 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:28 +0000 (09:39 -0800)
ec/17ce7a0008c968bc6bc912ee2c2d496bc89a01 [new file with mode: 0644]

diff --git a/ec/17ce7a0008c968bc6bc912ee2c2d496bc89a01 b/ec/17ce7a0008c968bc6bc912ee2c2d496bc89a01
new file mode 100644 (file)
index 0000000..96aba47
--- /dev/null
@@ -0,0 +1,177 @@
+Return-Path: <teythoon@jade-hamburg.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8CBFC431FD0\r
+       for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 14:14:31 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id HffRmS-l25J5 for <notmuch@notmuchmail.org>;\r
+       Sun, 25 Sep 2011 14:14:30 -0700 (PDT)\r
+X-Greylist: delayed 398 seconds by postgrey-1.32 at olra;\r
+       Sun, 25 Sep 2011 14:14:30 PDT\r
+Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 05D17431FB6\r
+       for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 14:14:29 -0700 (PDT)\r
+Received: from mail.jade-hamburg.de (unknown [85.183.11.228])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by mail.cryptobitch.de (Postfix) with ESMTPSA id EC6F75059BB\r
+       for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 23:07:48 +0200 (CEST)\r
+Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
+       id 512F0DF2A0; Sun, 25 Sep 2011 23:07:48 +0200 (CEST)\r
+Received: from thinkbox.jade-hamburg.de (unknown [85.183.11.228])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested) (Authenticated sender: teythoon)\r
+       by mail.jade-hamburg.de (Postfix) with ESMTPSA id A22F1DF28B;\r
+       Sun, 25 Sep 2011 23:07:44 +0200 (CEST)\r
+Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.76)\r
+       (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
+       id 1R7vvL-0007Bx-MM; Sun, 25 Sep 2011 23:07:43 +0200\r
+From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] properly raise exceptions in python bindings\r
+Date: Sun, 25 Sep 2011 23:07:35 +0200\r
+Message-Id:\r
+ <1316984855-27599-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
+X-Mailer: git-send-email 1.7.6.3\r
+X-Mailman-Approved-At: Mon, 26 Sep 2011 09:17:56 -0700\r
+Cc: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 25 Sep 2011 21:14:31 -0000\r
+\r
+There are various locations where exceptions are constructed but\r
+not raised. This patch adds the necessary raise statements.\r
+\r
+Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+---\r
+ bindings/python/notmuch/database.py |    4 ++--\r
+ bindings/python/notmuch/filename.py |    2 +-\r
+ bindings/python/notmuch/message.py  |    4 ++--\r
+ bindings/python/notmuch/tag.py      |    2 +-\r
+ bindings/python/notmuch/thread.py   |    6 +++---\r
+ 5 files changed, 9 insertions(+), 9 deletions(-)\r
+\r
+diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
+index dc124f5..a462789 100644\r
+--- a/bindings/python/notmuch/database.py\r
++++ b/bindings/python/notmuch/database.py\r
+@@ -530,7 +530,7 @@ class Query(object):\r
+         # create query, return None if too little mem available\r
+         query_p = Query._create(db.db_p, _str(querystr))\r
+         if query_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
+         self._query = query_p\r
\r
+     def set_sort(self, sort):\r
+@@ -598,7 +598,7 @@ class Query(object):\r
+         msgs_p = Query._search_messages(self._query)\r
\r
+         if msgs_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
\r
+         return Messages(msgs_p, self)\r
\r
+diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py\r
+index 630886d..a16e717 100644\r
+--- a/bindings/python/notmuch/filename.py\r
++++ b/bindings/python/notmuch/filename.py\r
+@@ -68,7 +68,7 @@ class Filenames(object):\r
+              once all derived objects are dead.\r
+         """\r
+         if files_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
\r
+         self._files = files_p\r
+         #save reference to parent object so we keep it alive\r
+diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py\r
+index 4f93a2a..a48900c 100644\r
+--- a/bindings/python/notmuch/message.py\r
++++ b/bindings/python/notmuch/message.py\r
+@@ -115,7 +115,7 @@ class Messages(object):\r
+                the Python object.(?)\r
+         """\r
+         if msgs_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
\r
+         self._msgs = msgs_p\r
+         #store parent, so we keep them alive as long as self  is alive\r
+@@ -292,7 +292,7 @@ class Message(object):\r
+               objects are dead.\r
+         """\r
+         if msg_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
+         self._msg = msg_p\r
+         #keep reference to parent, so we keep it alive\r
+         self._parent = parent\r
+diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py\r
+index 0f25b0f..50e3686 100644\r
+--- a/bindings/python/notmuch/tag.py\r
++++ b/bindings/python/notmuch/tag.py\r
+@@ -70,7 +70,7 @@ class Tags(object):\r
+                cache the tags in the Python object(?)\r
+         """\r
+         if tags_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
\r
+         self._tags = tags_p\r
+         #save reference to parent object so we keep it alive\r
+diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py\r
+index 83b4202..5e08eb3 100644\r
+--- a/bindings/python/notmuch/thread.py\r
++++ b/bindings/python/notmuch/thread.py\r
+@@ -95,7 +95,7 @@ class Threads(object):\r
+                the Python object.(?)\r
+         """\r
+         if threads_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
\r
+         self._threads = threads_p\r
+         #store parent, so we keep them alive as long as self  is alive\r
+@@ -206,7 +206,7 @@ class Thread(object):\r
+               objects are dead.\r
+         """\r
+         if thread_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
+         self._thread = thread_p\r
+         #keep reference to parent, so we keep it alive\r
+         self._parent = parent\r
+@@ -263,7 +263,7 @@ class Thread(object):\r
+         msgs_p = Thread._get_toplevel_messages(self._thread)\r
\r
+         if msgs_p is None:\r
+-            NotmuchError(STATUS.NULL_POINTER)\r
++            raise NotmuchError(STATUS.NULL_POINTER)\r
\r
+         return Messages(msgs_p, self)\r
\r
+-- \r
+1.7.6.3\r
+\r