[Numpy-discussion] error: no matching function for call to 'PyArray_DATA'

Sturla Molden sturla.molden at gmail.com
Thu Dec 11 23:05:32 EST 2014

Jack Howarth <howarth.mailing.lists at gmail.com> wrote:

> What is the correct coding to eliminate this error? I have found some
> threads which seems to suggest that PyArray_DATA is still available in
> numpy 1.9 as an inline but I haven't found any examples of projects
> patching their code to convert to that usage.

In the deprecated API, PyArray_DATA is a macro. In the new API,
PyArray_DATA is an inline function. While almost idential from the
perspective of user code, the inline function has an argument with a type.
Judging from the error message, the problem is that your NumPy array is
represented by PyObject* instead of PyArrayObject*, and your C compiler
says it cannot do the conversion automatically. The old macro version does
the typecast, so it does not matter if you give it PyObject*. Solution? Use
PyArrayObject* consistently in your code or typecast the PyObject* pointer
on each function call to PyArray_DATA.


More information about the NumPy-Discussion mailing list