[pypy-commit] pypy numpy-dtype: step 1 in getting Call2 to deal with dtypes

justinpeel noreply at buildbot.pypy.org
Wed Aug 3 02:16:59 CEST 2011


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: numpy-dtype
Changeset: r46220:9b7c9608f17c
Date: 2011-08-02 13:55 -0600
http://bitbucket.org/pypy/pypy/changeset/9b7c9608f17c/

Log:	step 1 in getting Call2 to deal with dtypes

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -334,6 +334,9 @@
     def eval(self, i):
         return self.value
 
+    def find_dtype(self):
+        return self.dtype
+
 # this is really only to simplify the tests. Maybe it should be moved?
 class FloatWrapper(ScalarWrapper):
     def __init__(self, value):
@@ -417,19 +420,24 @@
         self.function = function
         self.left = left
         self.right = right
-        try:
-            self.size = self.left.find_size()
-            self.dtype = self.left.find_dtype()
-        except:
-            self.size = self.right.find_size()
-            self.dtype = self.right.find_dtype()
+        dtype = self.left.find_dtype()
+        dtype2 = self.right.find_dtype()
+        if dtype.num >= dtype2.num:
+            self.dtype = dtype
+        elif dtype.num < dtype2.num:
+            self.dtype = dtype2
+        else:
+            self.dtype = dtype
 
     def _del_sources(self):
         self.left = None
         self.right = None
 
     def _find_size(self):
-        return self.size
+        try:
+            return self.left.find_size()
+        except:
+            return self.right.find_size()
 
     def _eval(self, i):
         lhs, rhs = self.left.eval(i), self.right.eval(i)


More information about the pypy-commit mailing list