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 0D1F5429E38 for ; Fri, 2 Dec 2011 06:20:45 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 G0VvFdVhzNCJ for ; Fri, 2 Dec 2011 06:20:41 -0800 (PST) Received: from jameswestby.net (jameswestby.net [89.145.97.141]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2400C429E36 for ; Fri, 2 Dec 2011 06:20:41 -0800 (PST) Received: from [74.220.184.116] (helo=dim.jameswestby.net) by jameswestby.net with esmtpa (Exim 4.69) (envelope-from ) id 1RWTyg-0007hx-1M; Fri, 02 Dec 2011 14:20:38 +0000 Received: by dim.jameswestby.net (Postfix, from userid 1000) id 35E5F5A1D41; Fri, 2 Dec 2011 09:20:35 -0500 (EST) From: James Westby To: Justus Winter <4winter@informatik.uni-hamburg.de>, Sebastian Spaeth , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] python: add classes to wrap all notmuch_*_t types In-Reply-To: References: <1318198374-926-1-git-send-email-4winter@informatik.uni-hamburg.de> <87vcr39e9q.fsf@SSpaeth.de> <87ty5kugq2.fsf@SSpaeth.de> <87hb1jc1gx.fsf@jameswestby.net> User-Agent: Notmuch/0.6.1-1 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 02 Dec 2011 09:20:35 -0500 Message-ID: <87y5uvnjgs.fsf@jameswestby.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Fri, 02 Dec 2011 14:20:45 -0000 On Fri, 02 Dec 2011 13:35:11 +0100, Justus Winter <4winter@informatik.uni-hamburg.de> wrote: > Huh, strange. My patch isn't supposed to change anything, it just > enables the ctypes package to check whether the functions from > libnotmuch are called with the right parameters, thus preventing > mistakes when changing the python bindings in the future. Where .restype is set to c_void_p ctypes spots this and returns it as int32. Where it's set to another callable (e.g. your custom types) it actually wraps the value by passing it to the callable and returning the result. Then, because your custom types are pointers, it stores them in an appropriate value, and also stops the storage being reused. I'll test again to make sure that I have this correct, but my tests yesterday certainly suggested that your patches fixed this. Thanks, James