champ_module.c (pymol-v1.8.6.0.tar.bz2) | : | champ_module.c (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 58 | skipping to change at line 58 | |||
return(ret); | return(ret); | |||
} | } | |||
static PyObject *RetInt(int ok,int result) /* status/integer return */ | static PyObject *RetInt(int ok,int result) /* status/integer return */ | |||
{ | { | |||
return(Py_BuildValue("(ii)",!ok,result)); | return(Py_BuildValue("(ii)",!ok,result)); | |||
} | } | |||
typedef void(*CObjectDestruct)(void*) ; | typedef void(*CObjectDestruct)(void*) ; | |||
#if PY_MAJOR_VERSION >= 3 | ||||
static void ChampCapsuleFree(PyObject * capsule) { | ||||
ChampFree(PyCapsule_GetPointer(capsule, NULL)); | ||||
} | ||||
#endif | ||||
static PyObject *_new(PyObject *self, PyObject *args) | static PyObject *_new(PyObject *self, PyObject *args) | |||
{ | { | |||
#if PY_MAJOR_VERSION >= 3 | ||||
void * I = ChampNew(); | ||||
return PyCapsule_New(I, NULL, ChampCapsuleFree); | ||||
#else | ||||
return(PyCObject_FromVoidPtr((void*)ChampNew(),(CObjectDestruct)ChampFree)); | return(PyCObject_FromVoidPtr((void*)ChampNew(),(CObjectDestruct)ChampFree)); | |||
#endif | ||||
} | } | |||
static PyObject *_memory_dump(PyObject *self, PyObject *args) | static PyObject *_memory_dump(PyObject *self, PyObject *args) | |||
{ | { | |||
int ok=true; | int ok=true; | |||
PyObject *O; | PyObject *O; | |||
CChamp *I; | CChamp *I; | |||
ok = PyArg_ParseTuple(args,"O",&O); | ok = PyArg_ParseTuple(args,"O",&O); | |||
ok = PyCObject_Check(O); | ok = PyCObject_Check(O); | |||
if(ok) { | if(ok) { | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 11 lines changed or added |