diff options
author | Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> | 2022-05-12 15:31:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 15:31:43 (GMT) |
commit | a24e67697362e76dd25d6901109277458b5971b9 (patch) | |
tree | 48fc18f93bb4981fc67136ef222bd4d601a8ae16 /Lib/test/test_sys_settrace.py | |
parent | 5d62759f98e82625277f46ea86a1a29b07b8ffe1 (diff) | |
download | cpython-a24e67697362e76dd25d6901109277458b5971b9.zip cpython-a24e67697362e76dd25d6901109277458b5971b9.tar.gz cpython-a24e67697362e76dd25d6901109277458b5971b9.tar.bz2 |
[3.10] gh-92311: Let frame_setlineno jump over listcomps (GH-92717)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 4f13bbd..76d1aee 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -2094,6 +2094,54 @@ output.append(4) yield 3 next(gen()) output.append(5) + + @jump_test(2, 3, [1, 3]) + def test_jump_forward_over_listcomp(output): + output.append(1) + x = [i for i in range(10)] + output.append(3) + + # checking for segfaults. + # See https://github.com/python/cpython/issues/92311 + @jump_test(3, 1, []) + def test_jump_backward_over_listcomp(output): + a = 1 + x = [i for i in range(10)] + c = 3 + + @jump_test(8, 2, [2, 7, 2]) + def test_jump_backward_over_listcomp_v2(output): + flag = False + output.append(2) + if flag: + return + x = [i for i in range(5)] + flag = 6 + output.append(7) + output.append(8) + + @async_jump_test(2, 3, [1, 3]) + async def test_jump_forward_over_async_listcomp(output): + output.append(1) + x = [i async for i in asynciter(range(10))] + output.append(3) + + @async_jump_test(3, 1, []) + async def test_jump_backward_over_async_listcomp(output): + a = 1 + x = [i async for i in asynciter(range(10))] + c = 3 + + @async_jump_test(8, 2, [2, 7, 2]) + async def test_jump_backward_over_async_listcomp_v2(output): + flag = False + output.append(2) + if flag: + return + x = [i async for i in asynciter(range(5))] + flag = 6 + output.append(7) + output.append(8) if __name__ == "__main__": |