Re: [PATCH 1/2] python: add classes to wrap all notmuch_*_t types

Subject: Re: [PATCH 1/2] python: add classes to wrap all notmuch_*_t types

Date: Fri, 02 Dec 2011 09:20:35 -0500

To: Justus Winter, Sebastian Spaeth, notmuch@notmuchmail.org

Cc:

From: James Westby


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

Thread: