[pypy-commit] pypy default: remove unnecessary cast so this extra assert isn't needed

bdkearns noreply at buildbot.pypy.org
Mon Oct 28 22:07:57 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r67659:b0865387a96d
Date: 2013-10-28 14:16 -0400
http://bitbucket.org/pypy/pypy/changeset/b0865387a96d/

Log:	remove unnecessary cast so this extra assert isn't needed

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
@@ -991,7 +991,7 @@
 
     def _read(self, storage, i, offset):
         res = raw_storage_getitem(self.T, storage, i + offset)
-        return rffi.cast(lltype.Float, byteswap(res))
+        return byteswap(res)
 
     def _write(self, storage, i, offset, value):
         swapped_value = byteswap(rffi.cast(self.T, value))
@@ -1052,14 +1052,6 @@
     BoxType = interp_boxes.W_Float32Box
     format_code = "f"
 
-    def read_bool(self, arr, i, offset):
-        # it's not clear to me why this is needed
-        # but a hint might be that calling for_computation(v)
-        # causes translation to fail, and the assert is necessary
-        v = self._read(arr.storage, i, offset)
-        assert isinstance(v, float)
-        return bool(v)
-
 class Float64(BaseType, Float):
     T = rffi.DOUBLE
     BoxType = interp_boxes.W_Float64Box


More information about the pypy-commit mailing list