diff options
author | Mark Shannon <mark@hotpy.org> | 2022-07-01 14:44:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-01 14:44:30 (GMT) |
commit | 02b30a8ef8fe591e7f5ebc00a885811a98f1d357 (patch) | |
tree | 4728c82eaaca7bb2e556c5a850b7c50d0794696e /Lib/test/test_sys_settrace.py | |
parent | 9fa966136fd026ecb74a21b4d63b699d3d40b977 (diff) | |
download | cpython-02b30a8ef8fe591e7f5ebc00a885811a98f1d357.zip cpython-02b30a8ef8fe591e7f5ebc00a885811a98f1d357.tar.gz cpython-02b30a8ef8fe591e7f5ebc00a885811a98f1d357.tar.bz2 |
[3.11] GH-94438: Backport GH-94444 (#94486)
* Account for NULLs on evaluation stack when jumping lines.
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-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): |