Commit b33d4941 authored by Stefan Behnel's avatar Stefan Behnel

Update documentation on deprecated NumPy C-API warnings.

parent e2dcfb58
......@@ -158,12 +158,31 @@ the necessary include files, e.g. for NumPy::
you have to add the path to NumPy include files. You need to add this path only
if you use ``cimport numpy``.
Despite this, you will still get warnings like the
following from the compiler, because Cython is using a deprecated Numpy API::
Despite this, you may still get warnings like the following from the compiler,
because Cython is not disabling the usage of the old deprecated Numpy API::
.../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" [-Wcpp]
For the time being, it is just a warning that you can ignore.
In Cython 3.0, you can get rid of this warning by defining the C macro
``NPY_NO_DEPRECATED_API`` as ``NPY_1_7_API_VERSION``
in your build, e.g.::
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
or (see below)::
Extension(
...,
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
)
With older Cython releases, setting this macro will fail the C compilation,
because Cython generates code that uses this deprecated C-API. However, the
warning has no negative effects even in recent NumPy versions including 1.18.x.
You can ignore it until you (or your library's users) switch to a newer NumPy
version that removes this long deprecated API, in which case you also need to
use Cython 3.0 or later. Thus, the earlier you switch to Cython 3.0, the
better for your users.
If you need to specify compiler options, libraries to link with or other
linker options you will need to create ``Extension`` instances manually
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment