Re: More python 2.7 fun: deprecation of PyCObject API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux