[Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

Paul Brossier piem at piem.org
Tue Mar 11 09:27:45 EDT 2014


On 08/03/2014 19:25, Charles R Harris wrote:
> 

Thanks for your quick reply Charles.

> On Sat, Mar 8, 2014 at 2:54 PM, Paul Brossier <piem at piem.org
> <mailto:piem at piem.org>> wrote:
> >
> >   2. When defining NPY_NO_DEPRECATED_API, as mentioned in the above
> >   warning and in the documentation, I get this error:
> >
> >           #error Should never include npy_deprecated_api directly.

ok, this error was triggered by some older version of numpy,
1.8.0.dev-4600b2f-20130131. updating to 1.8.0 fixed it.

sorry for the noise!

> >   The extension i'm trying to improve is aubio and can be found at
> >   http://aubio.org. A copy of the relevant code is at:
> >
> >   https://github.com/piem/aubio/blob/develop/python/ext/aubio-types.h
> >
> 
> You should include the same files whether or not NPY_NO_DEPRECATED_API
> is defined. Usually  numpy/arrayobject.h is the only needed include
> file. For instance, fftpack_litemodule.c has at the top
> 
> #define NPY_NO_DEPRECATED_API NPY_API_VERSION
> 
> #include "fftpack.h"
> #include "Python.h"
> #include "numpy/arrayobject.h"

Yes, that's pretty much what I do in aubio.

> Where in this case  NPY_API_VERSION is the current version,
> NPY_1_7_API_VERSION would be the numpy1.7.x API, etc. You use the
> version you intend to support and things deprecated after that version
> will still be available to you.

If I understand correctly, the current version is the one installed on
the user system. So using NPY_API_VERSION would mean "this code should
work with any version of numpy". I guess this is what I want (I would
even expect this to be the default setting). Did I miss something?

Thanks, Paul



More information about the NumPy-Discussion mailing list