Author: mattip <[email protected]>
Branch: numpypy-problems
Changeset: r58185:428ac7a5eb40
Date: 2012-10-17 00:31 +0200
http://bitbucket.org/pypy/pypy/changeset/428ac7a5eb40/

Log:    fixes for translation, running all test_numarray tests fail but
        running singly succeeds

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
@@ -275,8 +275,13 @@
             arr.storage[i] = arg[i]
         return W_StringBox(arr, 0, arr.dtype)
 
-    def convert_to(self, dtype):
-        return self.arr
+    # Running entire test suite needs this function to succeed,
+    # running single test_stringarray succeeds without it.
+    # With convert_to() test_ztranslation fails since 
+    # W_CharacterBox is not a W_GenericBox.
+    # Why is it needed for multiple tests?
+    #def convert_to(self, dtype):
+    #    xxx
 
 class W_UnicodeBox(W_CharacterBox):
     def descr__new__unicode_box(space, w_subtype, w_arg):
diff --git a/pypy/module/micronumpy/interp_ufuncs.py 
b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -478,7 +478,7 @@
             return interp_dtype.variable_dtype(space, 
                                                'S%d' % space.len_w(w_obj))
         elif current_guess.num ==18:
-            if  current_guess.itemtype.size < space.len_w(w_obj):
+            if  current_guess.itemtype.get_size() < space.len_w(w_obj):
                 return interp_dtype.variable_dtype(space, 
                                                    'S%d' % space.len_w(w_obj))
         return current_guess
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -1465,6 +1465,9 @@
     def get_element_size(self):
         return self.size * rffi.sizeof(self.T)
 
+    def get_size(self):
+        return self.size
+
 class StringType(BaseType, BaseStringType):
     T = lltype.Char
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to