[Numpy-discussion] PyArray_Resize with scipy.weave

Orest Kozyar orest.kozyar@gmail....
Wed Jun 4 14:12:40 CDT 2008

The following code fails:

from scipy import weave
from numpy import zeros

arr = zeros((10,2))
code = """
PyArray_Dims dims;
dims.len = 2;
dims.ptr = Narr;
dims.ptr[0] += 10;
PyArray_Resize(arr_array, &dims, 1);
weave.inline(code, ['arr'], verbose=1)

The error message is:
In function 'PyObject* compiled_func(PyObject*, PyObject*)':
<filename>:678: error: too few arguments to function

678 is the line number for PyArray_Resize.  According to the NumPy
Handbook, PyArray_Resize requires three arguments, which I am
providing. Am I missing something obvious here?  There are times when
I need to be able to resize the array in C++ because I cannot predict
exactly how big the array needs to be before I pass it to weave.  Any
advice or pointers greatly appreciated!


More information about the Numpy-discussion mailing list