[pypy-commit] pypy missing-ndarray-attributes: hack to make ztranslation pass

mattip noreply at buildbot.pypy.org
Mon Jan 21 19:41:27 CET 2013


Author: mattip <matti.picus at gmail.com>
Branch: missing-ndarray-attributes
Changeset: r60306:b345f036991d
Date: 2013-01-21 20:16 +0200
http://bitbucket.org/pypy/pypy/changeset/b345f036991d/

Log:	hack to make ztranslation pass

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
@@ -1015,6 +1015,14 @@
     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):
     _attrs_ = ()
 


More information about the pypy-commit mailing list