[Patch] tag.py: Bugfix to avoid decode() on a NoneType object
authorMichael Heinrich <michael@haas-heinrich.de>
Fri, 22 Jul 2011 14:11:41 +0000 (14:11 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:12 +0000 (09:39 -0800)
15/1be3b099230ccffe5fe9e6d1f0bd3886d53a4f [new file with mode: 0644]

diff --git a/15/1be3b099230ccffe5fe9e6d1f0bd3886d53a4f b/15/1be3b099230ccffe5fe9e6d1f0bd3886d53a4f
new file mode 100644 (file)
index 0000000..136d2ad
--- /dev/null
@@ -0,0 +1,92 @@
+Return-Path: <gmn-notmuch@m.gmane.org>\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 56EB9429E26\r
+       for <notmuch@notmuchmail.org>; Fri, 22 Jul 2011 07:15:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] 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 k-xbM-nF5TJY for <notmuch@notmuchmail.org>;\r
+       Fri, 22 Jul 2011 07:15:14 -0700 (PDT)\r
+Received: from lo.gmane.org (lo.gmane.org [80.91.229.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id 6B117431FD0\r
+       for <notmuch@notmuchmail.org>; Fri, 22 Jul 2011 07:15:14 -0700 (PDT)\r
+Received: from list by lo.gmane.org with local (Exim 4.69)\r
+       (envelope-from <gmn-notmuch@m.gmane.org>) id 1QkGVT-0006fE-QN\r
+       for notmuch@notmuchmail.org; Fri, 22 Jul 2011 16:15:11 +0200\r
+Received: from HSI-KBW-095-208-113-104.hsi5.kabel-badenwuerttemberg.de\r
+       ([95.208.113.104]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian))\r
+       id 1AlnuQ-0007hv-00\r
+       for <notmuch@notmuchmail.org>; Fri, 22 Jul 2011 16:15:11 +0200\r
+Received: from michael by\r
+       HSI-KBW-095-208-113-104.hsi5.kabel-badenwuerttemberg.de with\r
+       local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00\r
+       for <notmuch@notmuchmail.org>; Fri, 22 Jul 2011 16:15:11 +0200\r
+X-Injected-Via-Gmane: http://gmane.org/\r
+To: notmuch@notmuchmail.org\r
+From: Michael Heinrich <michael@haas-heinrich.de>\r
+Subject: [Patch] tag.py: Bugfix to avoid decode() on a NoneType object\r
+Date: Fri, 22 Jul 2011 14:11:41 +0000 (UTC)\r
+Lines: 32\r
+Message-ID: <loom.20110722T160702-94@post.gmane.org>\r
+Mime-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Transfer-Encoding: 7bit\r
+X-Complaints-To: usenet@dough.gmane.org\r
+X-Gmane-NNTP-Posting-Host: sea.gmane.org\r
+User-Agent: Loom/3.14 (http://gmane.org/)\r
+X-Loom-IP: 95.208.113.104 (Mozilla/5.0 (X11; Linux x86_64;\r
+       rv:2.0.1) Gecko/20100101 Firefox/4.0.1)\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: Fri, 22 Jul 2011 14:15:18 -0000\r
+\r
+Dear all,\r
+\r
+with current head I get following error in my python scripts when I read the\r
+tags of a message:\r
+\r
+  File "/home/heinrich/.local/lib/python2.6/site-packages/notmuch/tag.py", line\r
+88, in next\r
+    tag = Tags._get(self._tags).decode('utf-8')\r
+\r
+\r
+Here is a patch:\r
+\r
+diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py\r
+index 65a9118..e9049fc 100644\r
+--- a/bindings/python/notmuch/tag.py\r
++++ b/bindings/python/notmuch/tag.py\r
+@@ -85,10 +85,12 @@ class Tags(object):\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
+         # No need to call nmlib.notmuch_tags_valid(self._tags);\r
+         # Tags._get safely returns None, if there is no more valid tag.\r
+-        tag = Tags._get(self._tags).decode('utf-8')\r
++        tag = Tags._get(self._tags)\r
+         if tag is None:\r
+             self._tags = None\r
+             raise StopIteration\r
++        else:\r
++            tag = tag.decode('utf-8')\r
+         nmlib.notmuch_tags_move_to_next(self._tags)\r
+         return tag\r
\r
+\r
+Michael.\r
+\r