summaryrefslogtreecommitdiff
path: root/numpy/lib/_iotools.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/_iotools.py')
-rw-r--r--numpy/lib/_iotools.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py
index 84aff5e5d..ac5f4f9b4 100644
--- a/numpy/lib/_iotools.py
+++ b/numpy/lib/_iotools.py
@@ -506,13 +506,15 @@ class StringConverter:
_mapper.extend([(nx.float64, float, nx.nan),
(nx.complex128, complex, nx.nan + 0j),
(nx.longdouble, nx.longdouble, nx.nan),
- (nx.unicode_, asunicode, '???'),
- (nx.string_, asbytes, '???'),
# If a non-default dtype is passed, fall back to generic
# ones (should only be used for the converter)
(nx.integer, int, -1),
(nx.floating, float, nx.nan),
- (nx.complexfloating, complex, nx.nan + 0j),])
+ (nx.complexfloating, complex, nx.nan + 0j),
+ # Last, try with the string types (must be last, because
+ # `_mapper[-1]` is used as default in some cases)
+ (nx.unicode_, asunicode, '???'),
+ (nx.string_, asbytes, '???'),])
@classmethod
def _getdtype(cls, val):