The story: I'm trying to interface from C to Python in order to use the faster computational speed of C for an existing Python code. I already had some success, also with passing NumPy arrays - but now there seems to be an issue and I can't resolve it. This is the code:
#define FORMAT_VALUE_T "d"
char format_buffer[32];typedef struct{PyObject_HEADPyArrayObject *invmat;unsigned order;value_t weight, *buffer;} Det;typedef double value_t;typedef struct{PyObject_HEADDet *det;value_t *row, *covs, ratio, star;} DetAppendMove;static int append_init(DetAppendMove *self, PyObject *args, PyObject *kwds){value_t star, *temp;PyArrayObject *row, *col;PyObject *result = Py_BuildValue("(i)",1);Det *dete;snprintf(format_buffer, sizeof(format_buffer), "%s%s", "O!O!O!", FORMAT_VALUE_T);if (PyArg_ParseTuple(args, format_buffer, &DetType, &dete, &PyArray_Type, &row, &PyArray_Type, &col, &star)){ self->det = dete;temp = (value_t*)self->det->buffer;}else{result = Py_BuildValue("(i)",-1);}return result;}
It's not really doing anything by now, I just wanted to check if I'm able to pass those arrays.As the title says, I'm getting the following error message:
SystemError: NULL result without error in PyObject call
This is interesting, since I already passed some arrays once (did it the same way..) and usually these arrays are maybe 100x100 if even. Usually people complained about very large arrays..
I'm using Ubuntu 14.04 on a 64Bit machine, Python V2.7.6 and Numpy 1.8.2
It would be awesome if one of you could help me - I have no idea what's gone wrong here..
EDIT: I didn't figure out the issue yet, but sometimes it works, sometimes it crashes with the error from above.. I have absolutely no clue what this could be - anybody?