Conversation
This reverts commit 0d347a4.
lib/matplotlib/mlab.py
Outdated
| newdtype = np.dtype(rec.dtype.descr + list(zip(names, dtypes))) | ||
| old_dtypes = rec.dtype.descr | ||
| if six.PY2: | ||
| old_dtypes = [(a[0].encode('utf-8'), a[1]) for a in old_dtypes] |
There was a problem hiding this comment.
A bit less cryptic variant: old_dtypes = [(name.encode('utf-8'), dt) for name, dt in old_dtypes]
There was a problem hiding this comment.
Agreed but I am not sure this is the right solution anyway. The recarray can handle unicode keys it's only that np.dtype cannot. We should probably do this in a completely different way
|
I am inclined to merge this as-is. It improves things and we should not let the perfect be the enemy of the good here. |
|
I will at least implement @Kojoley's suggestion |
|
Implemented @Kojoley's sugestion. The proper solution is most likely to use |
Fixes #6866
urllib has moved from python 2 to 3. file is no more.
In mlab:
iterkeys was being called on the keys instead of the dict.
Unicode strings need to be encoded on python2 to be used in np.dtype
Should probably still add some tests to test_mlab.