Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/pypyjit/test_pypy_c/test_exception.py::TestException::()::test_continue_in_finally

self = <pypy.module.pypyjit.test_pypy_c.test_exception.TestException object at 0x0000000006727a98>

    def test_continue_in_finally(self):
        # check that 'continue' inside a try:finally: block is correctly
        # detected as closing a loop
        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("""
                i3 = int_lt(i1, i2)
                guard_true(i3, descr=...)
                i4 = int_add(i1, 1)
                --TICK--
                jump(..., descr=...)
            """)

pypy/module/pypyjit/test_pypy_c/test_exception.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pypy/module/pypyjit/test_pypy_c/model.py:177: in match
    return matcher.match(expected_src, **kwds)
pypy/module/pypyjit/test_pypy_c/model.py:524: in match
    self.match_loop(expected_ops, ignore_ops)
pypy/module/pypyjit/test_pypy_c/model.py:500: in match_loop
    self.match_op(op, exp_op)
pypy/module/pypyjit/test_pypy_c/model.py:409: in match_op
    self._assert(op.name == exp_opname, "operation mismatch")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x00007f3341f78de8>
cond = False, message = 'operation mismatch'

    def _assert(self, cond, message):
        if not cond:
>           raise InvalidMatch(message, frame=sys._getframe(1))
E           InvalidMatch: operation mismatch

pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
('operation mismatch',)
<could not determine information>

Ignore ops: []
Got:

	===== HERE =====
    guard_not_invalidated(descr=<Guard0x7efe047e3970>)
    i32 = int_lt(i27, i24)
    guard_true(i32, descr=<Guard0x7efe04710330>)
    i34 = int_add(i27, 1)
    i36 = getfield_raw_i(139629460523680, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i38 = int_lt(i36, 0)
    guard_false(i38, descr=<Guard0x7efe047103a0>)
    jump(p0, p1, p8, i34, p16, p18, i24, descr=TargetToken(139629461316000))

Expected:
    
    i3 = int_lt(i1, i2)
    guard_true(i3, descr=...)
    i4 = int_add(i1, 1)
    
    guard_not_invalidated?
    ticker0 = getfield_raw_i(#, descr=<FieldS pypysig_long_struct_inner.c_value .*>)
    ticker_cond0 = int_lt(ticker0, 0)
    guard_false(ticker_cond0, descr=...)
    
    jump(..., descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_exception.py::TestException::()::test_continue_in_finally