[Numpy-discussion] swig interface file (numpy.i) warning

Tom Krauss thomas.p.krauss@gmail....
Tue Oct 9 09:30:14 CDT 2012


I've been happy to use numpy.i for generating SWIG interfaces to C++.

For a while, I've noticed this warning while compiling:
warning: #warning "Using deprecated NumPy API, disable it by #defining

and today tried to get rid of the warning.

So, in numpy.i, I followed the warning's advice.  I added the # def here:

#include "stdio.h"
#include <numpy/arrayobject.h>

SWIG was happy, but when compiling the C++ wrapper, there were many
warnings followed by many errors.  The warnings were for redefinition
of NPY_MIN_BYTE and similar.  The errors were for all kinds of stuff,
excerpt here:
native_wrap.cpp:3632: error: ‘PyArray_NOTYPE’ was not declared in this scope
native_wrap.cpp:3633: error: cannot convert ‘PyObject*’ to ‘const
PyArrayObject*’ for argument ‘1’ to ‘int PyArray_TYPE(const PyArrayObject*)’
native_wrap.cpp: At global scope:
native_wrap.cpp:3877: error: ‘intp’ has not been declared
native_wrap.cpp: In function ‘int require_fortran(PyArrayObject*)’:
native_wrap.cpp:3929: error: ‘struct tagPyArrayObject’ has no member named
native_wrap.cpp:3933: error: ‘struct tagPyArrayObject’ has no member named
native_wrap.cpp:3933: error: ‘FARRAY’ was not declared in this scope
native_wrap.cpp:20411: error: ‘struct tagPyArrayObject’ has no member named

It looks like there is a new C API for numpy, and the version of numpy.i
that I have doesn't use it.

Is there a new version of numpy.i available (or in development) that works
with the new API?  Short term it will just get rid of a warning but I am
interested in a good long term solution in case I need to upgrade numpy.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20121009/403d2bc5/attachment.html 

More information about the NumPy-Discussion mailing list