On Mon, 2010-08-16 at 14:19 -0400, David Malcolm wrote:
> On Sat, 2010-08-14 at 19:42 +0100, Richard W.M. Jones wrote:
> > On Fri, Aug 13, 2010 at 02:20:51PM -0400, David Malcolm wrote:
[snip]
> Porting to the capsule API, I believe the code needs to look something
> like this (caution: untested):
>
> static guestfs_h *
> get_handle (PyObject *obj)
> {
> assert (obj);
> assert (obj != Py_None);
> return (guestfs_h*)PyCapsule_GetPointer(obj, "guestfs_h");
> }
>
Note that if someone passes a capsule that doesn't have a "guestfs_h" in
its name slot, then PyCapsule_GetPointer will raise an exception i.e.
return NULL and set thread-local state: ideally your generated wrapped
code needs to handle that case.
[snip]
--
devel mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/devel