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

James Westby jw+debian at jameswestby.net
Fri Dec 2 06:20:35 PST 2011


On Fri, 02 Dec 2011 13:35:11 +0100, Justus Winter <4winter at 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


More information about the notmuch mailing list