Author: Armin Rigo <[email protected]>
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=...)
+ """)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit