[Numpy-discussion] quick question about numpy deprecation warnings
Charles R Harris
Tue Jul 15 13:06:40 CDT 2008
On Tue, Jul 15, 2008 at 11:10 AM, Charles Doutriaux <firstname.lastname@example.org>
> Hi I have a quick question and i hope somebody can answer me (I admit I
> should first really check the numpy doc)
> I have been porting old Numeric based C code to numpy/numpy.ma for the
> alst couple weeks.
> Just as I thought I was done, this morning I updatethe numpy trunk and I
> now get the following deprecation warnings
> DeprecationWarning: PyArray_FromDims: use PyArray_SimpleNew.
> DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
> My quick question is:
> can I simply replace the function names or is the arg list different?
Not quite. They are actually macros.
ndarrayobject.h:#define PyArray_SimpleNew(nd, dims,
ndarrayobject.h- PyArray_New(&PyArray_Type, nd, dims, typenum, NULL,
NULL, 0, 0, NULL)
ndarrayobject.h:#define PyArray_SimpleNewFromData(nd, dims, typenum,
ndarrayobject.h- PyArray_New(&PyArray_Type, nd, dims, typenum,
ndarrayobject.h- data, 0, NPY_CARRAY, NULL)
ndarrayobject.h:#define PyArray_SimpleNewFromDescr(nd, dims,
ndarrayobject.h- PyArray_NewFromDescr(&PyArray_Type, descr, nd,
ndarrayobject.h- NULL, NULL, 0, NULL)
The main change is that dims needs to point to npy_intp instead of int so
that 64 bit architectures can use large arrays. I'm not sure the recommended
replacements are the best, I just copied them from comments in the source
code. Travis could perhaps clarify things a bit for us.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion