1 from cpython.ref cimport PyObject 2 3 cdef extern from "Python.h": 4 5 ########################################################################### 6 # Warning: 7 # 8 # The CObject API is deprecated as of Python 3.1. Please switch to 9 # the new Capsules API. 10 ########################################################################### 11 12 int PyCObject_Check(object p) 13 # Return true if its argument is a PyCObject. 14 15 object PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *)) 16 # Return value: New reference. 17 # 18 # Create a PyCObject from the void * cobj. The destr function will 19 # be called when the object is reclaimed, unless it is NULL. 20 21 object PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *)) 22 # Return value: New reference. 23 # 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. 27 28 void* PyCObject_AsVoidPtr(object self) except? NULL 29 # Return the object void * that the PyCObject self was created with. 30 31 void* PyCObject_GetDesc(object self) except? NULL 32 # Return the description void * that the PyCObject self was created with. 33 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 37 # failure. 38