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