[SciPy-dev] PyArray_FromDims and friends

Zachary Pincus zachary.pincus@yale....
Thu Aug 14 09:55:48 CDT 2008


> Zachary Pincus wrote:
>> In testing out svn scipy and numpy, I noticed some run-time errors
>> from scipy.interpolate because the _fitpack module's c sources use
>> PyArray_FromDims and PyArray_FromDimsAndData, which are now  
>> deprecated
>> in numpy svn.
>
> What is the preferred way to do it now? _minpack uses them  
> everywhere too.

As far as I can tell, PyArray_FromDims can be replaced with  
PyArray_SimpleNew -- they have the same function signature. If you  
want to be correct/avoid compiler warnings, you'd probably need to  
make sure to cast the second argument to (npy_intp*).

Likewise, PyArray_FromDimsAndData can be replaced with  
PyArray_SimpleNewFromData, with the same caveat about the cast.

So: it's a simple regexp to fix these two if you don't care about the  
casting, and a slightly more-involved one if you do. I'm not sure  
what's best here.

Zach


More information about the Scipy-dev mailing list