[pypy-commit] pypy default: There is actually another (rare) bytecode combination that makes

arigo noreply at buildbot.pypy.org
Wed Apr 18 18:07:44 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r54504:b09f20be15fd
Date: 2012-04-18 17:35 +0200
http://bitbucket.org/pypy/pypy/changeset/b09f20be15fd/

Log:	There is actually another (rare) bytecode combination that makes the
	position counter go backward.

diff --git a/pypy/module/pypyjit/test_pypy_c/test_exception.py b/pypy/module/pypyjit/test_pypy_c/test_exception.py
--- a/pypy/module/pypyjit/test_pypy_c/test_exception.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_exception.py
@@ -91,3 +91,29 @@
             --TICK--
             jump(..., descr=...)
         """)
+
+    def test_continue_in_finally(self):
+        # check that 'continue' inside a try:finally: block is correctly
+        # detected as closing a loop
+        py.test.skip("is this case important?")
+        def f(n):
+            i = 0
+            while 1:
+                try:
+                    if i < n:
+                        continue
+                finally:
+                    i += 1
+                return i
+
+        log = self.run(f, [2000])
+        assert log.result == 2001
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match("""
+            i40 = int_add_ovf(i31, 1)
+            guard_no_overflow(descr=...)
+            i41 = int_lt(i40, i33)
+            guard_true(i41, descr=...)
+            --TICK--
+            jump(..., descr=...)
+        """)


More information about the pypy-commit mailing list