[pypy-commit] pypy numpypy-problems: remove redundant code

mattip noreply at buildbot.pypy.org
Tue Aug 21 23:47:03 CEST 2012


Author: mattip <matti.picus at gmail.com>
Branch: numpypy-problems
Changeset: r56784:af96d10bceb0
Date: 2012-08-22 00:44 +0300
http://bitbucket.org/pypy/pypy/changeset/af96d10bceb0/

Log:	remove redundant code

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
@@ -212,8 +212,6 @@
     def __init__(self, arr, ofs=0, dtype=None):
         self.value = arr # we have to keep array alive
         self.ofs = ofs
-        if not dtype:
-            dtype = arr.dtype
         self.dtype = dtype
 
     def get_dtype(self, space):
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
@@ -900,10 +900,6 @@
     T = lltype.Char
     BoxType = interp_boxes.W_StringBox
 
-    @specialize.argtype(1)
-    def box(self, value):
-        return self.BoxType(rffi.cast(self.T, value), 0, None)
-
     def _coerce(self, space, w_item):
         return self.box(space.str_w(space.call_function(space.w_str, w_item)))
 
@@ -961,10 +957,10 @@
         return interp_boxes.W_VoidBox(arr, 0, arr.dtype)
 
     @jit.unroll_safe
-    def store(self, arr, i, ofs, box):
+    def store(self, value, i, ofs, box):
         assert isinstance(box, interp_boxes.W_VoidBox)
         for k in range(self.get_element_size()):
-            arr.storage[k + i] = box.arr.storage[k + box.ofs]
+            value.storage[k + i] = box.value.storage[k + box.ofs]
 
     @jit.unroll_safe
     def str_format(self, box):
@@ -976,7 +972,7 @@
                 first = False
             else:
                 pieces.append(", ")
-            pieces.append(tp.str_format(tp.read(box.arr, box.ofs, ofs)))
+            pieces.append(tp.str_format(tp.read(box.value, box.ofs, ofs)))
         pieces.append(")")
         return "".join(pieces)
 


More information about the pypy-commit mailing list