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 8CBFC431FD0 for ; Sun, 25 Sep 2011 14:14:31 -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 HffRmS-l25J5 for ; Sun, 25 Sep 2011 14:14:30 -0700 (PDT) X-Greylist: delayed 398 seconds by postgrey-1.32 at olra; Sun, 25 Sep 2011 14:14:30 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 05D17431FB6 for ; Sun, 25 Sep 2011 14:14:29 -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 EC6F75059BB for ; Sun, 25 Sep 2011 23:07:48 +0200 (CEST) Received: by mail.jade-hamburg.de (Postfix, from userid 401) id 512F0DF2A0; Sun, 25 Sep 2011 23:07:48 +0200 (CEST) Received: from thinkbox.jade-hamburg.de (unknown [85.183.11.228]) (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 A22F1DF28B; Sun, 25 Sep 2011 23:07:44 +0200 (CEST) Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.76) (envelope-from ) id 1R7vvL-0007Bx-MM; Sun, 25 Sep 2011 23:07:43 +0200 From: Justus Winter <4winter@informatik.uni-hamburg.de> To: notmuch@notmuchmail.org Subject: [PATCH] properly raise exceptions in python bindings Date: Sun, 25 Sep 2011 23:07:35 +0200 Message-Id: <1316984855-27599-1-git-send-email-4winter@informatik.uni-hamburg.de> X-Mailer: git-send-email 1.7.6.3 X-Mailman-Approved-At: Mon, 26 Sep 2011 09:17:56 -0700 Cc: Justus Winter <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: Sun, 25 Sep 2011 21:14:31 -0000 There are various locations where exceptions are constructed but not raised. This patch adds the necessary raise statements. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> --- bindings/python/notmuch/database.py | 4 ++-- bindings/python/notmuch/filename.py | 2 +- bindings/python/notmuch/message.py | 4 ++-- bindings/python/notmuch/tag.py | 2 +- bindings/python/notmuch/thread.py | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index dc124f5..a462789 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -530,7 +530,7 @@ class Query(object): # create query, return None if too little mem available query_p = Query._create(db.db_p, _str(querystr)) if query_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._query = query_p def set_sort(self, sort): @@ -598,7 +598,7 @@ class Query(object): msgs_p = Query._search_messages(self._query) if msgs_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) return Messages(msgs_p, self) diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py index 630886d..a16e717 100644 --- a/bindings/python/notmuch/filename.py +++ b/bindings/python/notmuch/filename.py @@ -68,7 +68,7 @@ class Filenames(object): once all derived objects are dead. """ if files_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._files = files_p #save reference to parent object so we keep it alive diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py index 4f93a2a..a48900c 100644 --- a/bindings/python/notmuch/message.py +++ b/bindings/python/notmuch/message.py @@ -115,7 +115,7 @@ class Messages(object): the Python object.(?) """ if msgs_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._msgs = msgs_p #store parent, so we keep them alive as long as self is alive @@ -292,7 +292,7 @@ class Message(object): objects are dead. """ if msg_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._msg = msg_p #keep reference to parent, so we keep it alive self._parent = parent diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py index 0f25b0f..50e3686 100644 --- a/bindings/python/notmuch/tag.py +++ b/bindings/python/notmuch/tag.py @@ -70,7 +70,7 @@ class Tags(object): cache the tags in the Python object(?) """ if tags_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._tags = tags_p #save reference to parent object so we keep it alive diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py index 83b4202..5e08eb3 100644 --- a/bindings/python/notmuch/thread.py +++ b/bindings/python/notmuch/thread.py @@ -95,7 +95,7 @@ class Threads(object): the Python object.(?) """ if threads_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._threads = threads_p #store parent, so we keep them alive as long as self is alive @@ -206,7 +206,7 @@ class Thread(object): objects are dead. """ if thread_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._thread = thread_p #keep reference to parent, so we keep it alive self._parent = parent @@ -263,7 +263,7 @@ class Thread(object): msgs_p = Thread._get_toplevel_messages(self._thread) if msgs_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) return Messages(msgs_p, self) -- 1.7.6.3