[pypy-commit] pypy foldable-getarrayitem-indexerror: a pypy-c test

cfbolz noreply at buildbot.pypy.org
Wed Jul 31 12:10:51 CEST 2013


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: foldable-getarrayitem-indexerror
Changeset: r65855:1a85c6a3e2fb
Date: 2013-07-31 12:10 +0200
http://bitbucket.org/pypy/pypy/changeset/1a85c6a3e2fb/

Log:	a pypy-c test

diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py
--- a/pypy/module/pypyjit/test_pypy_c/test_containers.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py
@@ -209,6 +209,22 @@
         opnames = log.opnames(loop.allops())
         assert opnames.count('new_with_vtable') == 0
 
+    def test_constfold_tuple(self):
+        code = """if 1:
+        tup = tuple(range(10000))
+        l = [1, 2, 3, 4, 5, 6, "a"]
+        def main(n):
+            while n > 0:
+                sub = tup[1]  # ID: getitem
+                l[1] = n # kill cache of tup[1]
+                n -= sub
+        """
+        log = self.run(code, [1000])
+        loop, = log.loops_by_filename(self.filepath)
+        ops = loop.ops_by_id('getitem', include_guard_not_invalidated=False)
+        assert log.opnames(ops) == []
+
+
     def test_specialised_tuple(self):
         def main(n):
             import pypyjit


More information about the pypy-commit mailing list