Author: mattip
Branch: missing-ndarray-attributes
Changeset: r60688:76b82f8c1076
Date: 2013-01-29 16:52 +0200
http://bitbucket.org/pypy/pypy/changeset/76b82f8c1076/

Log:    implement pass-through convert_to for String, Unicode boxes

diff --git a/pypy/module/micronumpy/interp_boxes.py 
b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -287,6 +287,11 @@
         for i in range(len(arg)):
             arr.storage[i] = arg[i]
         return W_StringBox(arr, 0, arr.dtype)
+            
+    def convert_to(self, dtype):
+        from pypy.modules.micronumpy import types
+        assert isinstance(dtype.itemtype, types.StringType)
+        return self        
 
 class W_UnicodeBox(W_CharacterBox):
     def descr__new__unicode_box(space, w_subtype, w_arg):
@@ -300,6 +305,11 @@
         #    arr.storage[i] = arg[i]
         return W_UnicodeBox(arr, 0, arr.dtype)
 
+    def convert_to(self, dtype):
+        from pypy.modules.micronumpy import types
+        assert isinstance(dtype.itemtype, types.UnicodeType)
+        return self        
+
 
 class W_ComplexFloatingBox(W_InexactBox):
     _attrs_ = ()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to