From 3b8cf12ee19994389ae3261666dd32cced4787be Mon Sep 17 00:00:00 2001 From: weathergod Date: Sun, 21 Nov 2010 18:37:51 -0700 Subject: BUG: Fix logic in handling of dtype in append_fields. --- numpy/lib/recfunctions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'numpy/lib/recfunctions.py') diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index 3c0094aae..da0c3e8ac 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -614,8 +614,10 @@ def append_fields(base, names, data=None, dtypes=None, if dtypes is None: data = [np.array(a, copy=False, subok=True) for a in data] data = [a.view([(name, a.dtype)]) for (name, a) in zip(names, data)] - elif not hasattr(dtypes, '__iter__'): - dtypes = [dtypes, ] + else : + if not hasattr(dtypes, '__iter__'): + dtypes = [dtypes, ] + if len(data) != len(dtypes): if len(dtypes) == 1: dtypes = dtypes * len(data) -- cgit v1.2.1