diff options
author | weathergod <?@?> | 2010-11-21 18:37:51 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-11-24 20:29:35 -0700 |
commit | f3d4e73d77c834dc6308861f2222e59433e6682b (patch) | |
tree | 558c7ac02f9689b7b804f1fa69231e2b9f7ce4f1 | |
parent | 5d2d2d8ed72c964488d24db0bb035ed7cfefd8c2 (diff) | |
download | numpy-maintenance/1.5.x.tar.gz |
BUG: Fix logic in handling of dtype in append_fields.maintenance/1.5.x
-rw-r--r-- | numpy/lib/recfunctions.py | 6 |
1 files changed, 4 insertions, 2 deletions
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) |