From 7b34e36c374376f537c8c27d59a9c6c15ba12de3 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 27 Jul 2011 12:44:30 -0400 Subject: [PATCH] In the old API, PyArray_DATA and PyArray_BYTES differ in that DATA returns a (void *) and BYTES returns a (char *). matplotlib builds were failing because PyArray_BYTES was returning a (void *). --- numpy/core/include/numpy/ndarraytypes.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index af705b936889..94c45df88237 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -1377,10 +1377,14 @@ PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v) arr); } +/* Same as PyArray_DATA */ +#define PyArray_BYTES(arr) PyArray_DATA(arr) + #else /* Macros are deprecated as of NumPy 1.7. */ #define PyArray_NDIM(obj) (((PyArrayObject_fieldaccess *)(obj))->nd) +#define PyArray_BYTES(obj) ((char *)(((PyArrayObject_fieldaccess *)(obj))->data)) #define PyArray_DATA(obj) ((void *)(((PyArrayObject_fieldaccess *)(obj))->data)) #define PyArray_DIMS(obj) (((PyArrayObject_fieldaccess *)(obj))->dimensions) #define PyArray_STRIDES(obj) (((PyArrayObject_fieldaccess *)(obj))->strides) @@ -1405,9 +1409,6 @@ PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v) (PyArrayObject *)(obj)) #endif -/* Same as PyArray_DATA */ -#define PyArray_BYTES(arr) PyArray_DATA(arr) - /* * Enables the specified array flags. Does no checking, * assumes you know what you're doing.