1 Return-Path: <wking@tremily.us>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 748216DE1763
\r
6 for <notmuch@notmuchmail.org>; Tue, 12 Jan 2016 10:53:12 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.009 tagged_above=-999 required=5 tests=[AWL=0.110,
\r
12 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=disabled
\r
14 Received: from arlo.cworth.org ([127.0.0.1])
\r
15 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id Brq3eumAHnCS for <notmuch@notmuchmail.org>;
\r
17 Tue, 12 Jan 2016 10:53:10 -0800 (PST)
\r
18 Received: from resqmta-po-12v.sys.comcast.net (resqmta-po-12v.sys.comcast.net
\r
20 by arlo.cworth.org (Postfix) with ESMTPS id D6D186DE1749
\r
21 for <notmuch@notmuchmail.org>; Tue, 12 Jan 2016 10:53:09 -0800 (PST)
\r
22 Received: from resomta-po-06v.sys.comcast.net ([96.114.154.230])
\r
23 by resqmta-po-12v.sys.comcast.net with comcast
\r
24 id 56t71s0034yXVJQ016t9os; Tue, 12 Jan 2016 18:53:09 +0000
\r
25 Received: from mail.tremily.us ([73.221.72.168])
\r
26 by resomta-po-06v.sys.comcast.net with comcast
\r
27 id 56r71s00B3dr3C9016r7gE; Tue, 12 Jan 2016 18:51:09 +0000
\r
28 Received: by mail.tremily.us (Postfix, from userid 1000)
\r
29 id 3C4A61B46A23; Tue, 12 Jan 2016 10:51:07 -0800 (PST)
\r
30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;
\r
31 t=1452624667; bh=9KQIevMJFlLFN6eNLg0J986b/sfueKfcR89hjZf5BJk=;
\r
32 h=Date:From:To:Cc:Subject:References:In-Reply-To;
\r
33 b=ndpbuq09968eG+lxKq16ezp+2wZj/rd1mpL0l+bWxymMmlXrDIOh0ba93eLovewj5
\r
34 5R8Ug0r3CoYeiJb3nOATELlg8Bfjx81TV/uCaUxX65xLpJBzatup213n0zGARvgOQp
\r
35 MOCUK00r971T060m7SQWUlV+Qm9jUoSx26gvJqKY=
\r
36 Date: Tue, 12 Jan 2016 10:51:07 -0800
\r
37 From: "W. Trevor King" <wking@tremily.us>
\r
38 To: Konrad Hinsen <konrad.hinsen@fastmail.net>
\r
39 Cc: notmuch@notmuchmail.org
\r
40 Subject: Re: Crash with Python bindings
\r
41 Message-ID: <20160112185107.GA21580@odin.tremily.us>
\r
42 References: <5694CA65.8010400@fastmail.net>
\r
43 <20160112102329.4269.20741@thinkbox.jade-hamburg.de>
\r
44 <m1y4budggd.fsf@fastmail.net>
\r
46 Content-Type: multipart/signed; micalg=pgp-sha1;
\r
47 protocol="application/pgp-signature"; boundary="YiEDa0DAkWCtVeE4"
\r
48 Content-Disposition: inline
\r
49 In-Reply-To: <m1y4budggd.fsf@fastmail.net>
\r
50 OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;
\r
51 url=http://tremily.us/pubkey.txt
\r
52 User-Agent: Mutt/1.5.23 (2014-03-12)
\r
53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
\r
54 s=q20140121; t=1452624789;
\r
55 bh=E4aoHYRBt7W+gLYX6FangOlEfjZh/14hMvL9kTPBuLI=;
\r
56 h=Received:Received:Received:Date:From:To:Subject:Message-ID:
\r
57 MIME-Version:Content-Type;
\r
58 b=ATZbjW8SGozesO+UsqNPvxVZE7/355bAI3j254gIhKfT+U7YYqoGZOxPFZ3v7Jxyu
\r
59 onNbENuRbj61B0ljo6kBJzRQAVqXUaISwwVV37x5pqmeOr99CtLUpNwtwZTtWaW6fp
\r
60 DnVgSfa5K4/gT3w7/+1he5y0IgRs6q2WVYSOI6uHp9Iovl25b+35ZOGeWfVE37PH73
\r
61 vtkNlO9rWRC1rsSGqcPdlXDcQytClVir4/sgFxtia94azbTuMQSdXigyJZa6xStw7F
\r
62 chn/V6MbHnM1oyQQ9ygB0jnuaLVVRtfpj5pWSgX1S2zkVLO4KlI9zcI7QUI8bjccit
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.20
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Tue, 12 Jan 2016 18:53:12 -0000
\r
80 Content-Type: text/plain; charset=us-ascii
\r
81 Content-Disposition: inline
\r
82 Content-Transfer-Encoding: quoted-printable
\r
84 On Tue, Jan 12, 2016 at 03:23:46PM +0100, Konrad Hinsen wrote:
\r
87 > > So I guess what happens is that Python3 changed how the
\r
88 > > interpreter environment is torn down and they actually destroy the
\r
89 > > 'q' object. If that is so, then your data is indeed safe.
\r
91 > That reminds me of a recent change in object finalization in Python
\r
94 > https://www.python.org/dev/peps/pep-0442/
\r
96 I'm pretty sure that is what's going on. The PEP landed in Python
\r
97 3.4, explaining why I don't see this issue in 3.3 [1]. And it has
\r
100 In particular, this PEP obsoletes the current guideline that
\r
101 "objects with a __del__ method should not be part of a reference
\r
104 I'm not sure what the best way is to fix __del__ in our Python
\r
105 bindings, but if you manage them explicitly:
\r
108 q =3D Query(db, "*")
\r
113 you can avoid the abort (which happens when q.__del__ is called after
\r
114 db.__del__). We could make that sort of cleanup easier with context
\r
115 managers for Query objects (we have them for databases since [3]), and
\r
116 they look like the only object that keep an internal database
\r
119 with Database() as db:
\r
120 with Query(db, "*") as q:
\r
121 # do something with q
\r
127 [1]: id:20160112180813.GA20499@odin.tremily.us
\r
128 [2]: https://www.python.org/dev/peps/pep-0442/#impact
\r
129 [3]: 36ce7e3c (python: implement the context manager protocol for
\r
130 database objects, 2012-02-15, v0.12)
\r
133 This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
\r
134 For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
\r
137 Content-Type: application/pgp-signature; name="signature.asc"
\r
138 Content-Description: OpenPGP digital signature
\r
140 -----BEGIN PGP SIGNATURE-----
\r
143 iQIcBAEBAgAGBQJWlUsXAAoJEAPqygegUbGs6PMQAILKu849YAttgTVyM3nar0nK
\r
144 rA5n0pN+NcnMml88pxRJdc3knL94qmhz89mHk2WFrFqBtodg5D3pnEhgaC+sSG23
\r
145 63gzTfhAQr98Kjb/R83qnwaulAQKd0Ed0QBNIb9sr0DTs35L4aVwlNnn1ducQqT5
\r
146 SAUT5uJVMoaaNs9YgNWPN4ov8xN2LdyyA5CYXICn8ZdYqLkJZdAe8QHGW40oQKhY
\r
147 +ERs+wqQQrcxh9REHJ/jZqp4BK3ocL/ULzXVsS5ZhWTZ8K4WIA3y9Nh5eao7bDbm
\r
148 RduCp3md33Qbw8CnN1zPQJ1XyE4EjK8D0T9+l95kBbBd05R50kKhLWNd/ItTcgn1
\r
149 Yc9dVOa8itfV8w3KaztlzlSfLTA6Y2P+P5qq33XjKR61n0WNm5QvPWfQp1kpIxyU
\r
150 k/TlpvbqajMGSOnWLbQZ1XReDCF7taPuoqBknZ02w9hhu8MErGYoQpQiae30a9f9
\r
151 2YBrourPhW+CXg0Wmqb3z3/uCp7vwUpxA1WgspWueJQSwgG/NgPkYZtb/tqwZe2X
\r
152 GZsOL3XCZnpSpWsI4Ow82lr1Gj2QhAgJDdZsjhnewCoYyDnTVf0cLDLJxfyKuJCF
\r
153 0vWAfdhoHjkdIaf6GUGsElSa/7xn0JmlrJeOe7wMRoaasQLjEaaWvQXoeVzBf2YC
\r
154 CMkNlG1aP5R4egGJjBlg
\r
156 -----END PGP SIGNATURE-----
\r
158 --YiEDa0DAkWCtVeE4--
\r