diff options
author | Mark Shannon <mark@hotpy.org> | 2022-07-01 13:01:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-01 13:01:14 (GMT) |
commit | be80db14c432c621e44920f8fd95a3f3191aca9b (patch) | |
tree | 15f11323e442796d0c92d96763dea288fae32db6 /Lib | |
parent | 022800253f254ba681a9f1093501a9fd1c15bed7 (diff) | |
download | cpython-be80db14c432c621e44920f8fd95a3f3191aca9b.zip cpython-be80db14c432c621e44920f8fd95a3f3191aca9b.tar.gz cpython-be80db14c432c621e44920f8fd95a3f3191aca9b.tar.bz2 |
GH-94438: Account for NULLs on evaluation stack when jumping lines. (GH-94444)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 162fd83..fd2740e 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -2264,25 +2264,25 @@ class JumpTestCase(unittest.TestCase): output.append(2) output.append(3) - @jump_test(1, 3, [], (ValueError, 'depth')) + @jump_test(1, 3, [], (ValueError, 'stack')) def test_no_jump_forwards_into_with_block(output): output.append(1) with tracecontext(output, 2): output.append(3) - @async_jump_test(1, 3, [], (ValueError, 'depth')) + @async_jump_test(1, 3, [], (ValueError, 'stack')) async def test_no_jump_forwards_into_async_with_block(output): output.append(1) async with asynctracecontext(output, 2): output.append(3) - @jump_test(3, 2, [1, 2, -1], (ValueError, 'depth')) + @jump_test(3, 2, [1, 2, -1], (ValueError, 'stack')) def test_no_jump_backwards_into_with_block(output): with tracecontext(output, 1): output.append(2) output.append(3) - @async_jump_test(3, 2, [1, 2, -1], (ValueError, 'depth')) + @async_jump_test(3, 2, [1, 2, -1], (ValueError, 'stack')) async def test_no_jump_backwards_into_async_with_block(output): async with asynctracecontext(output, 1): output.append(2) @@ -2584,6 +2584,63 @@ output.append(4) output.append(7) output.append(8) + # checking for segfaults. + @jump_test(3, 7, [], error=(ValueError, "stack")) + def test_jump_with_null_on_stack_load_global(output): + a = 1 + print( + output.append(3) + ) + output.append(5) + ( + ( # 7 + a + + + 10 + ) + + + 13 + ) + output.append(15) + + # checking for segfaults. + @jump_test(4, 8, [], error=(ValueError, "stack")) + def test_jump_with_null_on_stack_push_null(output): + a = 1 + f = print + f( + output.append(4) + ) + output.append(6) + ( + ( # 8 + a + + + 11 + ) + + + 14 + ) + output.append(16) + + # checking for segfaults. + @jump_test(3, 7, [], error=(ValueError, "stack")) + def test_jump_with_null_on_stack_load_attr(output): + a = 1 + list.append( + output, 3 + ) + output.append(5) + ( + ( # 7 + a + + + 10 + ) + + + 13 + ) + output.append(15) class TestExtendedArgs(unittest.TestCase): |