summaryrefslogtreecommitdiff
path: root/numpy/core/_internal.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-01-12 10:03:48 -0800
committerEric Wieser <wieser.eric@gmail.com>2018-01-13 19:25:32 -0800
commitdd8a2a8e29b0dc85dca4d2964c92df3604acc212 (patch)
treea8c7de4f88edddb9d5b12a92b08a02bb6eef4688 /numpy/core/_internal.py
parent5f01e54b20e38d483e8bab31bf5f953a860fe8d3 (diff)
downloadnumpy-dd8a2a8e29b0dc85dca4d2964c92df3604acc212.tar.gz
BUG: Instead of returning garbage, make dtype.descr error for out-of-order fields
Diffstat (limited to 'numpy/core/_internal.py')
-rw-r--r--numpy/core/_internal.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 004c2762b..8c6596d13 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -110,6 +110,10 @@ def _array_descr(descriptor):
num = field[1] - offset
result.append(('', '|V%d' % num))
offset += num
+ elif field[1] < offset:
+ raise ValueError(
+ "dtype.descr is not defined for types with overlapping or "
+ "out-of-order fields")
if len(field) > 3:
name = (field[2], field[3])
else: