Capsule.c 558 Bytes
Newer Older
1
//////////////// Capsule.proto ////////////////
2

3 4 5 6
/* Todo: wrap the rest of the functionality in similar functions */
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);

//////////////// Capsule ////////////////
7

8
static CYTHON_INLINE PyObject *
9
__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
10 11 12 13 14 15 16 17 18 19 20
{
    PyObject *cobj;

#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
    cobj = PyCapsule_New(p, sig, NULL);
#else
    cobj = PyCObject_FromVoidPtr(p, NULL);
#endif

    return cobj;
}