[pypy-commit] pypy numpy-dtype-alt: attempted fixes for translation, don't work.

alex_gaynor noreply at buildbot.pypy.org
Mon Aug 15 06:36:52 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: numpy-dtype-alt
Changeset: r46508:3348730f5806
Date: 2011-08-14 21:40 -0700
http://bitbucket.org/pypy/pypy/changeset/3348730f5806/

Log:	attempted fixes for translation, don't work.

diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -66,7 +66,7 @@
         self.unerase(storage)[i] = item.val
 
     def setitem_w(self, space, storage, i, w_item):
-        self.setitem(storage, i, self.Box(self.unwrap(space, w_item)))
+        self.setitem(storage, i, self.unwrap(space, w_item))
 
     @specialize.argtype(1)
     def adapt_val(self, val):
@@ -200,7 +200,7 @@
         return dtype.adapt_val(self.val)
 
 def make_box(TP, v=None):
-    class Box(BaseBox):
+    class Box(BaseBox, object):
         valtype = v
     Box.__name__ = "%sBox" % TP.TO.OF._name
     return Box
@@ -216,7 +216,7 @@
     Box = make_box(TP, bool)
 
     def unwrap(self, space, w_item):
-        return space.is_true(w_item)
+        return self.Box(space.is_true(w_item))
 
 class W_Int8Dtype(LowLevelDtype, W_Dtype):
     num = 1
@@ -241,7 +241,7 @@
     Box = make_box(TP)
 
     def unwrap(self, space, w_item):
-        return space.int_w(space.int(w_item))
+        return self.Box(space.int_w(space.int(w_item)))
 
 class W_Int64Dtype(LowLevelDtype, W_Dtype):
     num = 9
@@ -256,7 +256,7 @@
     Box = make_box(TP)
 
     def unwrap(self, space, w_item):
-        return space.float_w(space.float(w_item))
+        return self.Box(space.float_w(space.float(w_item)))
 
     def str_format(self, item):
         return float2string(item.val, 'g', rfloat.DTSF_STR_PRECISION)
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
@@ -308,7 +308,7 @@
 @specialize.arg(1)
 def scalar(space, dtype, w_obj):
     dtype = space.fromcache(dtype)
-    return dtype.Box(dtype.unwrap(space, w_obj))
+    return dtype.unwrap(space, w_obj)
 
 class Scalar(BaseArray):
     """


More information about the pypy-commit mailing list