From 663c3dbf9e9fbc5dd8fd084ed17897f508de3198 Mon Sep 17 00:00:00 2001 From: Francesco Montesano Date: Tue, 3 Jun 2014 18:56:20 +0200 Subject: [PATCH 1/2] bug fix: check the type of the 'key' of the two array 'r1' and 'r2' --- lib/matplotlib/mlab.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index bcf79d84d82b..cef02978e87d 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -2631,8 +2631,11 @@ def key_desc(name): if dt1.type != np.string_: return (name, dt1.descr[0][1]) - dt2 = r1.dtype[name] - assert dt2==dt1 + dt2 = r2.dtype[name] + if dt1 != dt2: + msg = "The type of the '{}' in the arrays 'r1' and 'r2' must be of" + msg += " the same type" + raise ValueError(msg.format(name)) if dt1.num>dt2.num: return (name, dt1.descr[0][1]) else: From 590eeb8312a67a689958c8a852037f4cc4a6f9fe Mon Sep 17 00:00:00 2001 From: Francesco Montesano Date: Tue, 3 Jun 2014 23:44:38 +0200 Subject: [PATCH 2/2] Error message written in proper English --- lib/matplotlib/mlab.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index cef02978e87d..5c7d14cdec22 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -2633,8 +2633,8 @@ def key_desc(name): dt2 = r2.dtype[name] if dt1 != dt2: - msg = "The type of the '{}' in the arrays 'r1' and 'r2' must be of" - msg += " the same type" + msg = "The '{}' fields in arrays 'r1' and 'r2' must have the same" + msg += " dtype." raise ValueError(msg.format(name)) if dt1.num>dt2.num: return (name, dt1.descr[0][1])