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 2D481429E54 for ; Sat, 21 Jan 2012 22:01:50 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Date" X-Spam-Flag: NO X-Spam-Score: 0.432 X-Spam-Level: X-Spam-Status: No, score=0.432 tagged_above=-999 required=5 tests=[INVALID_DATE=0.432] 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 aV+IMnpwJDlk for ; Sat, 21 Jan 2012 22:01:49 -0800 (PST) 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 3D5CD429E40 for ; Sat, 21 Jan 2012 22:01:49 -0800 (PST) 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 1A0C85102A5 for ; Sun, 22 Jan 2012 07:01:47 +0100 (CET) Received: by mail.jade-hamburg.de (Postfix, from userid 401) id 4FD8CDF2A3; Sun, 22 Jan 2012 07:01:46 +0100 (CET) Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.109]) (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 6CF39DF2A1 for ; Sun, 22 Jan 2012 07:01:42 +0100 (CET) Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) (envelope-from ) id 1RoqUn-0007d5-DL for notmuch@notmuchmail.org; Sun, 22 Jan 2012 07:01:41 +0100 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Date: Sun, 22 Jan 2012 06:01:41 -0000 To: notmuch mailing list Message-ID: <20120122060141.16806.41461@thinkbox.jade-hamburg.de> From: Justus Winter <4winter@informatik.uni-hamburg.de> Subject: heads up from the python front Date: Sun, 22 Jan 2012 07:01:41 +0100 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, 22 Jan 2012 06:01:50 -0000 Hey everyone :) after getting to know nmbug a little better (it's actually very nice to track bugs and patches this way...) I did some work on the python bindings. tl;dr version: housekeeping, python3.2 support, fixed nasty bug. I familiarized myself with nmbug and went through all the threads tagged with notmuch::python, added and updated few tags here and there and started working on the open issues. Python 3.2 support ------------------ I merged the last patch of a patchset[0] I wrote in december that makes it possible to use the python bindings with both python2.x and python3.2. I do not now how complete the port is, most notably the notmuch.py script does not work with 3.x. But it is complete enough to make afew[1] work using python3.2 and the vanilla notmuch bindings. If you want to help out and have a small script that uses the bindings I'd like to invite you to try to port your script and report any issues. Fix random crashes when using the bindings ------------------------------------------ I found a nasty bug I introduced with a patchset[2] that was supposed to make the bindings more robust. Annotating pointers returned from libnotmuch functions called using ctypes allows the ctypes framework to do typechecking. But I accidentally broke the error handling code. Citing the commit message: Before 3434d1940 the return values of libnotmuch functions were declared as c_void_p and the code checking for errors compared the returned value to None, which is the ctypes equivalent of a NULL pointer. But said commit wrapped all the data types in python classes and the semantic changed in a subtle way. If a function returns NULL, the wrapped python value is falsish, but no longer equal to None. In fact the minimal test case triggering the bug is: import os import notmuch db_path =3D os.path.expanduser('~/Maildir') db_0 =3D notmuch.Database(db_path, mode=3Dnotmuch.Database.MODE.READ_WR= ITE) db_1 =3D notmuch.Database(db_path, mode=3Dnotmuch.Database.MODE.READ_WR= ITE) The problem was most apparent when opening the database fails because it has been locked by someone else. The patch regarding the function Database.open looks like this: res =3D Database._open(_str(path), mode) = - if res is None: + if not res: raise NotmuchError(message=3D"Could not open the specified dat= abase") self._db =3D res The old code fails to notify the callee of the error who causes a segfault later if he uses that database reference which is in fact NULL. I feel kind of bad since I severely broke the error handling for all pythonic notmuch users out there, is there any chance of a bugfix release? The patch[3] is really simple and I'd say it's trivial to backport it to the last release. What do you think? Justus 0: id:1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de 1: https://github.com/teythoon/afew 2: id:1318198374-926-1-git-send-email-4winter@informatik.uni-hamburg.de 3: 8015cbff263606f009b5750d23b28ee332c25db8