Author: mattip <[email protected]>
Branch: str-dtype-improvement
Changeset: r62388:214de91f0dae
Date: 2013-03-17 00:31 -0700
http://bitbucket.org/pypy/pypy/changeset/214de91f0dae/

Log:    fix translation

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
@@ -278,7 +278,7 @@
                              dtype.coerce(space, w_value))
 
     def convert_to(self, dtype):
-        assert dtype.fields == self.dtype.fields
+        # TODO actually perform the conversion, this requires a space arg
         return self
 
 class W_CharacterBox(W_FlexibleBox):
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
@@ -414,7 +414,7 @@
     if promote_to_float:
         return find_unaryop_result_dtype(space, dt2, promote_to_float=True)
     # If they're the same kind, choose the greater one.
-    if dt1.kind == dt2.kind and dt1.fields == dt2.fields:
+    if dt1.kind == dt2.kind and dt2.is_flexible_type():
         return dt2
 
     # Everything promotes to float, and bool promotes to everything.
@@ -438,18 +438,16 @@
         # For those operations that get here (concatenate, stack),
         # flexible types take precedence over numeric type
         if dt2.is_record_type():
-            if dt1.fields == dt2.fields:
-                #record types require an exact match
-                return dt2
-            return None
+            #TODO record types require an exact match
+            return dt2
         if dt1.is_str_or_unicode():
             if dt2.num == 18:
                 size = max(dt2.itemtype.get_element_size(), 
                            dt1.itemtype.get_element_size())
-                return interp_dtype.new_string_type(size)
+                return interp_dtype.new_string_dtype(space, size)
             size = max(dt2.itemtype.get_element_size(), 
                        dt1.itemtype.get_element_size())
-            return interp_dtype.new_unitype_type(size)
+            return interp_dtype.new_unicode_dtype(space, size)
         return dt2
     else:    
         # increase to the next signed type
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to