Re: [C++-sig] Stuck on accessing numpy.ndarray in c extension
No, I did not use raw_function for the export.I tried hello.testArray((c,)), it crashed. Then I used PyArray_Check(args) to check the input type, it crashed even when I passed a numpy.ndarray to it. void testArray(PyObject * args) { if(!(PyArray_Check(args))) { printf("args is not list type!\n"); return; } }
a = numpy.arange(25).reshape((5,5)); rarray2 = hello.testArray(a,) Segmentation fault
a = numpy.arange(25).reshape((5,5)); rarray2 = hello.testArray(a) Segmentation fault
A *segmentation* *fault* occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed. It seems my PyObject * args can not neither be acessed by PyArray_Check() nor by PyArg_ParseTuple(). I don't get it. -- Qinfeng(Javen) Shi Research School of Information Sciences and Engineering Australian National University Locked Bag 8001 Canberra ACT 2601
participants (1)
-
Qinfeng(Javen) Shi