summaryrefslogtreecommitdiff
path: root/numpy/core/records.py
diff options
context:
space:
mode:
authorChris Billington <chrisjbillington@gmail.com>2018-08-16 16:27:28 -0400
committerCharles Harris <charlesr.harris@gmail.com>2018-08-16 15:27:28 -0500
commitfcbc3ba0130dd1e9b7046f934bf0ffd6ee2c362d (patch)
tree8a9cb039d18ad710b0876af32297fdc8d8a92006 /numpy/core/records.py
parent591880b0a7bcbb493d9ec023783157818f2f5236 (diff)
downloadnumpy-fcbc3ba0130dd1e9b7046f934bf0ffd6ee2c362d.tar.gz
BUG: Fixes for unicode field names in Python 2 (#11642)
* Fixes for unicode field names in Python 2 * Allow specifying a single comma-separated unicode string of names in np.rec.fromarrays * Allow sorting on unicode field names. This addresses some of the problems raised in issue #2407 * Use skipif decorator, check constructed array has correct data * cleaner isinstance() check, have new tests to run on py3 as well * Fix silly mistake in test
Diffstat (limited to 'numpy/core/records.py')
-rw-r--r--numpy/core/records.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/records.py b/numpy/core/records.py
index 612d39322..a483871ba 100644
--- a/numpy/core/records.py
+++ b/numpy/core/records.py
@@ -42,7 +42,7 @@ import warnings
from . import numeric as sb
from . import numerictypes as nt
-from numpy.compat import isfileobj, bytes, long
+from numpy.compat import isfileobj, bytes, long, unicode
from .arrayprint import get_printoptions
# All of the functions allow formats to be a dtype
@@ -174,7 +174,7 @@ class format_parser(object):
if (names):
if (type(names) in [list, tuple]):
pass
- elif isinstance(names, str):
+ elif isinstance(names, (str, unicode)):
names = names.split(',')
else:
raise NameError("illegal input names %s" % repr(names))