numpy/numpy — pull request #2780 by luispedro (2012-12-03 11:11:50+00:00)
Title: API Make PyArray_DATA return void*

PyArray_DATA is documented as returning void*. Changing it to return
char* breaks code such as (in C++)::

float* my_floats = static_cast(PyArray_DATA(my_array));

PyArray_BYTES returns char*, but is otherwise the same function.

*

This was previously discussed here: https://github.com/numpy/numpy/commit/abf0489b69496af2c9e19f8bf41356fa511e5f1a
as it caused a compilation error in mahotas:
https://github.com/luispedro/mahotas/issues/26

My main argument is that http://docs.scipy.org/doc/numpy/reference/c-api.array.html clearly states that PyArray_DATA returns ``void*`` and unless there is a strong reason against changing the public API, it should not change. In this case, there is even a perfect alternative for those who wish to have the ``char*``: ``PyArray_BYTES``.