summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/include/numpy/ndarraytypes.h2
-rw-r--r--numpy/core/src/multiarray/flagsobject.c5
-rw-r--r--numpy/core/src/private/lowlevel_strided_loops.h12
3 files changed, 10 insertions, 9 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
index 919ef55e0..f7898753b 100644
--- a/numpy/core/include/numpy/ndarraytypes.h
+++ b/numpy/core/include/numpy/ndarraytypes.h
@@ -757,7 +757,7 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
/*
* Note: all 0-d arrays are C_CONTIGUOUS and F_CONTIGUOUS. An N-d
- * array that is C_CONTIGUOUS may also be F_CONTIGUOUS if only
+ * array that is C_CONTIGUOUS is also F_CONTIGUOUS if only
* one axis has a dimension different from one (ie. a 1x3x1 array).
*/
diff --git a/numpy/core/src/multiarray/flagsobject.c b/numpy/core/src/multiarray/flagsobject.c
index 7542f6ca1..b26ac9813 100644
--- a/numpy/core/src/multiarray/flagsobject.c
+++ b/numpy/core/src/multiarray/flagsobject.c
@@ -88,9 +88,10 @@ PyArray_UpdateFlags(PyArrayObject *ret, int flagmask)
/*
* Check whether the given array is stored contiguously
- * in memory. And update the passed in ap apropriately.
+ * in memory. And update the passed in ap flags apropriately.
*
- * 0-strided arrays are not contiguous. A dimension == 1 is always ok.
+ * A dimension == 1 stride is ignored for contiguous flags and a 0-sized array
+ * is always both C- and F-Contiguous. 0-strided arrays are not contiguous.
*/
static void
_UpdateContiguousFlags(PyArrayObject *ap)
diff --git a/numpy/core/src/private/lowlevel_strided_loops.h b/numpy/core/src/private/lowlevel_strided_loops.h
index e7a20a67a..94c6a2121 100644
--- a/numpy/core/src/private/lowlevel_strided_loops.h
+++ b/numpy/core/src/private/lowlevel_strided_loops.h
@@ -554,7 +554,7 @@ PyArray_PrepareThreeRawArrayIter(int ndim, npy_intp *shape,
stride = ((PyArray_NDIM(arr) == 0) ? 0 : \
((PyArray_NDIM(arr) == 1) ? \
PyArray_STRIDE(arr, 0) : \
- PyArray_DESCR(arr)->elsize)) \
+ PyArray_ITEMSIZE(arr))) \
#define PyArray_TRIVIALLY_ITERABLE_PAIR(arr1, arr2) (\
@@ -577,10 +577,10 @@ PyArray_PrepareThreeRawArrayIter(int ndim, npy_intp *shape,
data2 = PyArray_BYTES(arr2); \
stride1 = (size1 == 1 ? 0 : ((PyArray_NDIM(arr1) == 1) ? \
PyArray_STRIDE(arr1, 0) : \
- PyArray_DESCR(arr1)->elsize)); \
+ PyArray_ITEMSIZE(arr1))); \
stride2 = (size2 == 1 ? 0 : ((PyArray_NDIM(arr2) == 1) ? \
PyArray_STRIDE(arr2, 0) : \
- PyArray_DESCR(arr2)->elsize)); \
+ PyArray_ITEMSIZE(arr2))); \
}
#define PyArray_TRIVIALLY_ITERABLE_TRIPLE(arr1, arr2, arr3) (\
@@ -618,13 +618,13 @@ PyArray_PrepareThreeRawArrayIter(int ndim, npy_intp *shape,
data3 = PyArray_BYTES(arr3); \
stride1 = (size1 == 1 ? 0 : ((PyArray_NDIM(arr1) == 1) ? \
PyArray_STRIDE(arr1, 0) : \
- PyArray_DESCR(arr1)->elsize)); \
+ PyArray_ITEMSIZE(arr1))); \
stride2 = (size2 == 1 ? 0 : ((PyArray_NDIM(arr2) == 1) ? \
PyArray_STRIDE(arr2, 0) : \
- PyArray_DESCR(arr2)->elsize)); \
+ PyArray_ITEMSIZE(arr2))); \
stride3 = (size3 == 1 ? 0 : ((PyArray_NDIM(arr3) == 1) ? \
PyArray_STRIDE(arr3, 0) : \
- PyArray_DESCR(arr3)->elsize)); \
+ PyArray_ITEMSIZE(arr3))); \
}
#endif