summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/ma/core.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 510a59d1a..23f6bc037 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -800,20 +800,15 @@ def make_mask_descr(ndtype):
"""
def _make_descr(datatype):
"Private function allowing recursion."
- datatype = np.dtype(datatype)
# Do we have some name fields ?
if datatype.names:
descr = []
- # !!!: If one of the fieldnames is a tuple, only its last element
- # !!!: is listed in datatype.names: we need to take datatype.descr.
- for name in (_[0] for _ in datatype.descr):
- # Take the last element of the tuple as key for datatype.fields
- if isinstance(name, tuple):
- # datatype.fields[name] is a tuple of 2 or 3 element...
- ndtype = datatype.fields[name[-1]][0]
- else:
- ndtype = datatype.fields[name][0]
- descr.append((name, _make_descr(ndtype)))
+ for name in datatype.names:
+ field = datatype.fields[name]
+ if len(field) == 3:
+ # Prepend the title to the name
+ name = (field[-1], name)
+ descr.append((name, _make_descr(field[0])))
return descr
# Is this some kind of composite a la (np.float,2)
elif datatype.subdtype: