8000 Merge pull request #121 from mdboom/PyArray_DATA-cast · numpy/numpy@d5b29c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5b29c4

Browse files
committed
Merge pull request #121 from mdboom/PyArray_DATA-cast
Fix PyArray_BYTES return type.
2 parents 9163993 + 7b34e36 commit d5b29c4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

numpy/core/include/numpy/ndarraytypes.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,10 +1377,14 @@ PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v)
13771377
arr);
13781378
}
13791379

1380+
/* Same as PyArray_DATA */
1381+
#define PyArray_BYTES(arr) PyArray_DATA(arr)
1382+
13801383
#else
13811384

13821385
/* Macros are deprecated as of NumPy 1.7. */
13831386
#define PyArray_NDIM(obj) (((PyArrayObject_fieldaccess *)(obj))->nd)
1387+
#define PyArray_BYTES(obj) ((char *)(((PyArrayObject_fieldaccess *)(obj))->data))
13841388
#define PyArray_DATA(obj) ((void *)(((PyArrayObject_fieldaccess *)(obj))->data))
13851389
#define PyArray_DIMS(obj) (((PyArrayObject_fieldaccess *)(obj))->dimensions)
13861390
#define PyArray_STRIDES(obj) (((PyArrayObject_fieldaccess *)(obj))->strides)
@@ -1405,9 +1409,6 @@ PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v)
14051409
(PyArrayObject *)(obj))
14061410
#endif
14071411

1408-
/* Same as PyArray_DATA */
1409-
#define PyArray_BYTES(arr) PyArray_DATA(arr)
1410-
14111412
/*
14121413
* Enables the specified array flags. Does no checking,
14131414
* assumes you know what you're doing.

0 commit comments

Comments
 (0)
0