I have code that has two Python functions, run () and dudt (u, t, ...). run calls the C function, odepack_odeint, which calls the Fortran subroutine, LSODA, which calls another C function, ode_function, which calls dudt. If there is an error in dudt, it can be printed with ode_function using PyErr_Print (), but I cannot figure out how to say that the code will stop execution. I tried,
PyErr_Print() PyErr_SetString(errobj, message)
in ode_function, but then the segfaults code. As far as I understand, it should happen that ode_function will return NULL or -1 or something else. However, LSODA expects the ode_function to be invalid.
This is an attempt to fix scipy.integrate.odeint based on this question that I asked earlier.
source share