[SciPy-dev] PyArray_FromDims and friends

Charles Doutriaux doutriaux1@llnl....
Thu Aug 14 11:28:32 CDT 2008

You definately want to cast to npy_intp !
It did bite us when we went to 64bit!


Zachary Pincus wrote:
>> 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
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http:// projects.scipy.org/mailman/listinfo/scipy-dev

More information about the Scipy-dev mailing list