Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 222ed14

Browse files
committed
np.dtype does not support unicode strings on python 2.7 so encode before creating
1 parent b172ec6 commit 222ed14

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/mlab.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,8 +2596,10 @@ def mapped_r2field(name):
25962596
if desc[0] not in key]
25972597
r2desc = [(mapped_r2field(desc[0]), desc[1]) for desc in r2.dtype.descr
25982598
if desc[0] not in key]
2599-
newdtype = np.dtype(keydesc + r1desc + r2desc)
2600-
2599+
all_dtypes = keydesc + r1desc + r2desc
2600+
if six.PY2:
2601+
all_dtypes = [(a[0].encode('utf-8'), a[1]) for a in all_dtypes]
2602+
newdtype = np.dtype(all_dtypes)
26012603
newrec = np.recarray((common_len + left_len + right_len,), dtype=newdtype)
26022604

26032605
if defaults is not None:

0 commit comments

Comments
 (0)