Author: Brian Kearns <bdkea...@gmail.com>
Branch: 
Changeset: r69405:3b2b6edf5c23
Date: 2014-02-25 00:56 -0500
http://bitbucket.org/pypy/pypy/changeset/3b2b6edf5c23/

Log:    cleanup

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
@@ -52,7 +52,9 @@
     def descr_reduce(self, space):
         return self.reduce(space)
 
-    return descr__new__, staticmethod(_get_dtype), descr_reduce
+    return (func_with_new_name(descr__new__, 'box_descr__new__%d' % num),
+            staticmethod(_get_dtype),
+            descr_reduce)
 
 
 class Box(object):
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
@@ -31,11 +31,10 @@
     specialize.argtype(1)(func)
     @functools.wraps(func)
     def dispatcher(self, v):
-        raw = self.unbox(v)
         return self.box(
             func(
                 self,
-                self.for_computation(raw),
+                self.for_computation(self.unbox(v)),
             )
         )
     return dispatcher
@@ -145,7 +144,6 @@
         array = rffi.cast(rffi.CArrayPtr(self.T), data)
         return self.box(array[0])
 
-    @specialize.argtype(1)
     def unbox(self, box):
         assert isinstance(box, self.BoxType)
         return box.value
@@ -1111,11 +1109,16 @@
         array = rffi.cast(rffi.CArrayPtr(self.T), data)
         return self.box_complex(array[0], array[1])
 
+    def composite(self, v1, v2):
+        assert isinstance(v1, self.ComponentBoxType)
+        assert isinstance(v2, self.ComponentBoxType)
+        real = v1.value
+        imag = v2.value
+        return self.box_complex(real, imag)
+
     def unbox(self, box):
         assert isinstance(box, self.BoxType)
-        # do this in two stages since real, imag are read only
-        real, imag = box.real, box.imag
-        return real, imag
+        return box.real, box.imag
 
     def _read(self, storage, i, offset):
         real = raw_storage_getitem_unaligned(self.T, storage, i + offset)
@@ -1167,14 +1170,6 @@
                 return rfloat.NAN, rfloat.NAN
             return rfloat.INFINITY, rfloat.INFINITY
 
-    @specialize.argtype(1)
-    def composite(self, v1, v2):
-        assert isinstance(v1, self.ComponentBoxType)
-        assert isinstance(v2, self.ComponentBoxType)
-        real = v1.value
-        imag = v2.value
-        return self.box_complex(real, imag)
-
     @complex_unary_op
     def pos(self, v):
         return v
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to