--- /dev/null
+Return-Path: <konrad.hinsen@fastmail.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 0BED16DE176B\r
+ for <notmuch@notmuchmail.org>; Tue, 12 Jan 2016 01:49:21 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.719\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.719 tagged_above=-999 required=5 tests=[AWL=0.101,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ SPF_PASS=-0.001] 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 0EaMhNYaMws5 for <notmuch@notmuchmail.org>;\r
+ Tue, 12 Jan 2016 01:49:19 -0800 (PST)\r
+Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com\r
+ [66.111.4.28])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 28ABD6DE176A\r
+ for <notmuch@notmuchmail.org>; Tue, 12 Jan 2016 01:49:19 -0800 (PST)\r
+Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])\r
+ by mailout.nyi.internal (Postfix) with ESMTP id 5F6AD210CA\r
+ for <notmuch@notmuchmail.org>; Tue, 12 Jan 2016 04:41:59 -0500 (EST)\r
+Received: from frontend1 ([10.202.2.160])\r
+ by compute5.internal (MEProxy); Tue, 12 Jan 2016 04:41:59 -0500\r
+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h=\r
+ content-transfer-encoding:content-type:date:from:message-id\r
+ :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=V3h\r
+ f7Y+u8G5oRresdGvKzsjfQ58=; b=nJlGlJt7dAEiqxh4EZsOPG5emn2BIuDNV8j\r
+ tF6k4YlBmVM1hVbbcx4YD1ASPzUbwZMrc7MSTzYdhSkxMJDyPkzZnAX32/QZ/gwL\r
+ 4cGsx8zJYahEWA5M5mdZoUDjjaGPELsFozWXPDqsTGJtf9pYiqlkGxmp3GJ0xVJw\r
+ e334Ctus=\r
+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=\r
+ messagingengine.com; h=content-transfer-encoding:content-type\r
+ :date:from:message-id:mime-version:subject:to:x-sasl-enc\r
+ :x-sasl-enc; s=smtpout; bh=V3hf7Y+u8G5oRresdGvKzsjfQ58=; b=c2xnM\r
+ 4IdrMQdUHWRgR5Ed5nL2BN15q9eZU689OHR0ExDAdGg5oHbFxSF8TmNAHgCr2Iyr\r
+ R/ou1KXVkc/bjBCic4vlMQDaKwZjiFdP/gx6bu3x6zuRedpOipnsBtS4KpKjmssz\r
+ B4pjnSRIUbh+YsZgHtY196k9vThJqwxo3rkXTA=\r
+X-Sasl-enc: EOS2e5eDzVUSrl0VMs0Q2VOn0n0oAwHI/QBfu8fg5psJ 1452591719\r
+Received: from Ordinateur-de-Catherine--Konrad.local\r
+ (mic92-2-82-67-216-6.fbx.proxad.net [82.67.216.6])\r
+ by mail.messagingengine.com (Postfix) with ESMTPA id C6F2BC013FE;\r
+ Tue, 12 Jan 2016 04:41:58 -0500 (EST)\r
+To: notmuch@notmuchmail.org\r
+From: Konrad Hinsen <konrad.hinsen@fastmail.net>\r
+Subject: Crash with Python bindings\r
+Message-ID: <5694CA65.8010400@fastmail.net>\r
+Date: Tue, 12 Jan 2016 10:41:57 +0100\r
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0)\r
+ Gecko/20100101 Thunderbird/38.5.1\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8; format=flowed\r
+Content-Transfer-Encoding: 7bit\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: Tue, 12 Jan 2016 09:49:21 -0000\r
+\r
+Hi everyone,\r
+\r
+I have been writing quite a few Python scripts for notmuch before \r
+running into a strange bug. Here is a minimal script producing it:\r
+\r
+--------------------------------------------------\r
+from notmuch import Query, Database\r
+\r
+def foo(bar):\r
+ pass\r
+\r
+db = Database()\r
+q = Query(db, "*")\r
+db.close()\r
+--------------------------------------------------\r
+\r
+Running this script (Python 3.5, MacOS X) yields:\r
+\r
+[1] 22478 abort pydev3 Temp/notmuch_test.py\r
+\r
+The crash actually happens *after* db.close(), when the Python \r
+interpreter exists, and therefore I suspect that no data is lost, but I \r
+hesitate to use scripts with that behavior in production use.\r
+\r
+The strange part is that what causes the crash is the presence of the \r
+function foo(), even though it is never called. Remove foo and the \r
+script runs fine. It is also necessary to create a Query object. The \r
+combination of a function definition (any) and the creation of a Query \r
+object yields the crash. This looks like a memory management issue, but \r
+I didn't explore it any further.\r
+\r
+Cheers,\r
+ Konrad.\r