[pypy-commit] pypy numpy-multidim: write another test, I'm a moron

fijal noreply at buildbot.pypy.org
Fri Oct 28 21:03:09 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-multidim
Changeset: r48587:d5d0e247d026
Date: 2011-10-28 21:01 +0200
http://bitbucket.org/pypy/pypy/changeset/d5d0e247d026/

Log:	write another test, I'm a moron

diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -74,7 +74,9 @@
             return BoolObject(obj)
         elif isinstance(obj, int):
             return IntObject(obj)
-        return obj
+        elif isinstance(obj, W_Root):
+            return obj
+        raise NotImplementedError
 
     def newlist(self, items):
         return ListObject(items)
diff --git a/pypy/module/micronumpy/test/test_zjit.py b/pypy/module/micronumpy/test/test_zjit.py
--- a/pypy/module/micronumpy/test/test_zjit.py
+++ b/pypy/module/micronumpy/test/test_zjit.py
@@ -184,6 +184,17 @@
         # This is 3, not 2 because there is a bridge for the exit.
         self.check_loop_count(3)
 
+    def test_slice(self):
+        result = self.run("""
+        a = |30| * 3
+        b = a -> ::3
+        c = b + b
+        c -> 3
+        """)
+        assert result == 27 * 2
+        self.check_loops({'int_mul': 1, 'getarrayitem_raw': 2, 'float_mul': 2,
+                          'setarrayitem_raw': 1, 'int_add': 1,
+                          'int_lt': 1, 'guard_true': 1, 'jump': 1})
 
 class TestNumpyOld(LLJitMixin):
     def setup_class(cls):


More information about the pypy-commit mailing list