Skip to content

Commit 33e95c5

Browse files
committed
Merge pull request #3111 from montefra/mlab_bug
bug fix: check the type of the 'key' of the two array 'r1' and 'r2'
2 parents ba72279 + 590eeb8 commit 33e95c5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/mlab.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,8 +2631,11 @@ def key_desc(name):
26312631
if dt1.type != np.string_:
26322632
return (name, dt1.descr[0][1])
26332633

2634-
dt2 = r1.dtype[name]
2635-
assert dt2==dt1
2634+
dt2 = r2.dtype[name]
2635+
if dt1 != dt2:
2636+
msg = "The '{}' fields in arrays 'r1' and 'r2' must have the same"
2637+
msg += " dtype."
2638+
raise ValueError(msg.format(name))
26362639
if dt1.num>dt2.num:
26372640
return (name, dt1.descr[0][1])
26382641
else:

0 commit comments

Comments
 (0)