I have been working on my first C extension, using NumPy arrays, and have run into a problem.
I have a very mysterious set of bugs, that result in a segmentation fault and core dump. Frankly it's still mysterious, but at the moment the problem seems to be that I have passed in a list of tuples, rather than a list of PyArrayObjects. I don't expect this to work, but when I put a :
site = PyList_GetItem(spam_list, index);
if (! PyArray_Check(spam)) result = 0;
I shouldn't get a crash!! (and it does crash at this line, as near as I can tell) Isn't that exactly what PyArray_Check is for??
with: spam = PyList_GetItem(spam_list, index);
I get a "warning: assignment from incompatible pointer type "
which goes away if I typecast it:
spam = (PyArrayObject *) PyList_GetItem(spam_list, index);
Should I be doing this, and should PyArray_Check(spam) work either way?
I'm using Redhat Linux 6.1, Python 1.5.2, and python-numpy-1.11-2.i386.rpm
Also: is there a compelling reason to upgrade either Python of NumPy, from the NumPy perspective? How are NumPy and 2.0 working together?