So, I want to call a Python callback function from C.
At some point, the function is sent to C and packed into a tuple like this
PyObject *userData = Py_BuildValue("Oi",py_callback,some_number);
Somewhere in that area, I do Py_INCREF(py_callback)
, too.
At some later time in the program, I want to call that function
PyObject *py_callback;
int some_number;
PyArg_ParseTuple((PyObject*)userData,"Oi",&py_callback,&some_number); // returns true
PyObject *py_result = PyObject_CallFunctionObjArgs(py_callback,
/* ... */
NULL);
and that last call throws a segmentation fault. Do you have any idea, why it would do such a thing?