diff options
author | mattip <matti.picus@gmail.com> | 2019-05-02 11:29:10 -0400 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2019-05-03 02:28:06 -0400 |
commit | b90addd13f17d967d81dc1d7515887d4fcd6ef59 (patch) | |
tree | 218e91b081078123e279ef268c8969cf07fb10bb /numpy/lib/format.py | |
parent | 666d92ac85a6adf0fec7361c3340fc6ab12c8330 (diff) | |
download | numpy-b90addd13f17d967d81dc1d7515887d4fcd6ef59.tar.gz |
BUG: parse more subarrays in descr_to_dtype
Diffstat (limited to 'numpy/lib/format.py')
-rw-r--r-- | numpy/lib/format.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/numpy/lib/format.py b/numpy/lib/format.py index abd98dd22..05fcbc0bc 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -267,10 +267,15 @@ def descr_to_dtype(descr): This function reverses the process, eliminating the empty padding fields. ''' - if isinstance(descr, (str, dict, tuple)): + if isinstance(descr, (str, dict)): # No padding removal needed return numpy.dtype(descr) - + elif isinstance(descr, tuple): + if isinstance(descr[0], list): + # subtype, will always have a shape descr[1] + dt = descr_to_dtype(descr[0]) + return numpy.dtype((dt, descr[1])) + return numpy.dtype(descr) fields = [] offset = 0 for field in descr: |