[Cython] NumPy 1.7+ warnings

Stefan Behnel stefan_ml at behnel.de
Wed Jun 25 21:16:36 CEST 2014


Hi,

recent NumPy versions are a bit unhappy about Cython code and generate
deprecation warnings about it:

.../numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning:
#warning "Using deprecated NumPy API, disable it by " "#defining
NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"

I don't know how much work it would be to port the C code properly, but it
should be mostly about updating the implementation in Cython's
"numpy/__init__.pxd", which is dated anyway.

Given that NumPy 1.7 appeared not much more than a year ago, dropping
support for older versions sounds a bit aggressive, but there should be a
way to keep supporting them by defining some macros, similar to what we do
for CPython in ModuleSetupCode.c. Any volunteers?

The relevant bits of NumPy's C-API are described here:

http://docs.scipy.org/doc/numpy-dev/reference/c-api.array.html

My guess is that most of the work should be replacing direct access to
ndarray struct fields with C macro calls. That won't easily fix user code,
but it's the first major step on the way.

Stefan


More information about the cython-devel mailing list