mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-94438: Account for NULLs on evaluation stack when jumping lines. (GH-94444)
This commit is contained in:
parent
022800253f
commit
be80db14c4
3 changed files with 106 additions and 17 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue