--- /dev/null
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 5B2DB6DE0FF1\r
+ for <notmuch@notmuchmail.org>; Wed, 9 Dec 2015 18:12:59 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.05\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.05 tagged_above=-999 required=5 tests=[AWL=-0.050]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id rBARnm2DMfYw for <notmuch@notmuchmail.org>;\r
+ Wed, 9 Dec 2015 18:12:56 -0800 (PST)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id B55556DE005F\r
+ for <notmuch@notmuchmail.org>; Wed, 9 Dec 2015 18:12:55 -0800 (PST)\r
+Received: from fifthhorseman.net (unknown [38.109.115.130])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 2F549F984\r
+ for <notmuch@notmuchmail.org>; Wed, 9 Dec 2015 21:12:52 -0500 (EST)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id 121AA20548; Wed, 9 Dec 2015 21:12:53 -0500 (EST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH] add notmuch.Database.get_status_string()\r
+Date: Wed, 9 Dec 2015 21:12:53 -0500\r
+Message-Id: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.6.2\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 10 Dec 2015 02:12:59 -0000\r
+\r
+This gives some additional access to debugging information when using\r
+the python bindings.\r
+---\r
+ bindings/python/notmuch/database.py | 13 +++++++++++++\r
+ 1 file changed, 13 insertions(+)\r
+\r
+diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
+index 5b58e09..5f80267 100644\r
+--- a/bindings/python/notmuch/database.py\r
++++ b/bindings/python/notmuch/database.py\r
+@@ -114,6 +114,11 @@ class Database(object):\r
+ _get_all_tags.argtypes = [NotmuchDatabaseP]\r
+ _get_all_tags.restype = NotmuchTagsP\r
+ \r
++ """notmuch_database_status_string"""\r
++ _get_status_string = nmlib.notmuch_database_status_string\r
++ _get_status_string.argtypes = [NotmuchDatabaseP]\r
++ _get_status_string.restype = c_char_p\r
++\r
+ """notmuch_database_create"""\r
+ _create = nmlib.notmuch_database_create\r
+ _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)]\r
+@@ -575,6 +580,14 @@ class Database(object):\r
+ """\r
+ return Query(self, querystring)\r
+ \r
++ def get_status_string(self):\r
++ """Returns the status string of the database\r
++\r
++ This is sometimes used for additional error reporting\r
++ """\r
++ self._assert_db_is_initialized()\r
++ return Database._get_status_string(self._db).decode('utf-8', 'ignore')\r
++\r
+ def __repr__(self):\r
+ return "'Notmuch DB " + self.get_path() + "'"\r
+ \r
+-- \r
+2.6.2\r
+\r