Author: mattip <matti.pi...@gmail.com>
Branch: 
Changeset: r76895:2301f0bf4a68
Date: 2015-04-23 01:24 +0300
http://bitbucket.org/pypy/pypy/changeset/2301f0bf4a68/

Log:    encode unicode dtype spec to ascii

diff --git a/pypy/module/micronumpy/descriptor.py 
b/pypy/module/micronumpy/descriptor.py
--- a/pypy/module/micronumpy/descriptor.py
+++ b/pypy/module/micronumpy/descriptor.py
@@ -545,6 +545,8 @@
                        space.gettypefor(boxes.W_VoidBox),
                        shape=shape, subdtype=subdtype, elsize=size)
 
+    if space.isinstance_w(w_dtype, space.w_unicode):
+        w_dtype = space.wrap(space.str_w(w_dtype)) # may raise if invalid
     if space.is_none(w_dtype):
         return cache.w_float64dtype
     elif space.isinstance_w(w_dtype, w_subtype):
diff --git a/pypy/module/micronumpy/test/test_dtypes.py 
b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -58,6 +58,7 @@
         assert exc.value[0] == "there are no fields defined"
 
         assert dtype('int8').num == 1
+        assert dtype(u'int8').num == 1
         assert dtype('int8').name == 'int8'
         assert dtype('void').name == 'void'
         assert dtype(int).fields is None
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to