1
2cdef extern from "Python.h":
3
4    ###########################################################################
5    # Warning:
6    #
7    # The CObject API is deprecated as of Python 3.1. Please switch to
8    # the new Capsules API.
9    ###########################################################################
10
11    int PyCObject_Check(object p)
12    #     Return true if its argument is a PyCObject.
13
14    object PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
15    #     Return value: New reference.
16    #
17    #     Create a PyCObject from the void * cobj. The destr function will
18    #     be called when the object is reclaimed, unless it is NULL.
19
20    object PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
21    #     Return value: New reference.
22    #
23    #     Create a PyCObject from the void * cobj. The destr function will
24    #     be called when the object is reclaimed. The desc argument can be
25    #     used to pass extra callback data for the destructor function.
26
27    void* PyCObject_AsVoidPtr(object self) except? NULL
28    #     Return the object void * that the PyCObject self was created with.
29
30    void* PyCObject_GetDesc(object self) except? NULL
31    #     Return the description void * that the PyCObject self was created with.
32
33    int PyCObject_SetVoidPtr(object self, void* cobj) except 0
34    #     Set the void pointer inside self to cobj. The PyCObject must not
35    #     have an associated destructor. Return true on success, false on
36    #     failure.
37