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 BFA85429E25 for ; Thu, 1 Dec 2011 15:25: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 iEemiEjpDvpL for ; Thu, 1 Dec 2011 15:25:45 -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 373D2431FD0 for ; Thu, 1 Dec 2011 15:25:45 -0800 (PST) Received: from [74.220.184.116] (helo=dim.jameswestby.net) by jameswestby.net with esmtpa (Exim 4.69) (envelope-from ) id 1RWG0d-0006cP-SL for notmuch@notmuchmail.org; Thu, 01 Dec 2011 23:25:44 +0000 Received: by dim.jameswestby.net (Postfix, from userid 1000) id 3CC1B5A4AE0; Thu, 1 Dec 2011 18:25:43 -0500 (EST) From: James Westby To: notmuch@notmuchmail.org Subject: Re: [PATCH] python: Store pointers as c_void_p to keep references In-Reply-To: <1322781185-15923-1-git-send-email-jw+debian@jameswestby.net> References: <87pqg8b9hx.fsf@jameswestby.net> <1322781185-15923-1-git-send-email-jw+debian@jameswestby.net> User-Agent: Notmuch/0.6.1-1 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Thu, 01 Dec 2011 18:25:43 -0500 Message-ID: <87k46fc1s8.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: Thu, 01 Dec 2011 23:25:45 -0000 On Thu, 1 Dec 2011 18:13:05 -0500, James Westby wrote: > From: James Westby > > ctypes doesn't return c_void_p return values as that, it returns them as > 32-bit integers instead. This has two problems: > > 1 - On 64-bit machines anything higher than the max 32-bit integer > will overflow when passed back in to another function expecting, > a pointer giving the wrong value. > > 2 - If the value isn't stored as a pointer then the memory can be > re-used and so the object will be corrupted. > > The fix for both of these is to store the values as pointers. http://osdir.com/ml/python.ctypes/2006-12/msg00048.html states that this is expected behaviour of ctypes. Thanks, James