summaryrefslogtreecommitdiff
path: root/numpy/core/include
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2019-08-28 12:52:18 -0400
committerAllan Haldane <allan.haldane@gmail.com>2019-08-28 13:53:58 -0400
commit847aefc8a5dc239f2937cf369de0895e94e78533 (patch)
tree67c821d39a989f72718a73c6cd5311e2d696ff8c /numpy/core/include
parent9cc5f99f3281ade5eef6b097f5853eb8bb471416 (diff)
downloadnumpy-847aefc8a5dc239f2937cf369de0895e94e78533.tar.gz
BUG: view with fieldless dtype should raise if itemsize != 0
Fixes #14344
Diffstat (limited to 'numpy/core/include')
-rw-r--r--numpy/core/include/numpy/ndarraytypes.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
index 1221aeece..bda000da9 100644
--- a/numpy/core/include/numpy/ndarraytypes.h
+++ b/numpy/core/include/numpy/ndarraytypes.h
@@ -1695,7 +1695,8 @@ PyArray_CLEARFLAGS(PyArrayObject *arr, int flags)
#define PyDataType_ISOBJECT(obj) PyTypeNum_ISOBJECT(((PyArray_Descr*)(obj))->type_num)
#define PyDataType_HASFIELDS(obj) (((PyArray_Descr *)(obj))->names != NULL)
#define PyDataType_HASSUBARRAY(dtype) ((dtype)->subarray != NULL)
-#define PyDataType_ISUNSIZED(dtype) ((dtype)->elsize == 0)
+#define PyDataType_ISUNSIZED(dtype) ((dtype)->elsize == 0 && \
+ !PyDataType_HASFIELDS(dtype))
#define PyDataType_MAKEUNSIZED(dtype) ((dtype)->elsize = 0)
#define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))