Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions Lib/test/test_sys_settrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,8 @@ def test_jump_in_nested_finally_3(output):
output.append(11)
output.append(12)

@jump_test(5, 11, [2, 4, 12])
def test_jump_over_return_try_finally_in_finally_block(output):
@jump_test(5, 11, [2, 4], (ValueError, 'unreachable'))
def test_no_jump_over_return_try_finally_in_finally_block(output):
try:
output.append(2)
finally:
Expand All @@ -963,8 +963,8 @@ def test_jump_over_return_try_finally_in_finally_block(output):
pass
output.append(12)

@jump_test(3, 4, [1, 4])
def test_jump_infinite_while_loop(output):
@jump_test(3, 4, [1], (ValueError, 'unreachable'))
def test_no_jump_infinite_while_loop(output):
output.append(1)
while True:
output.append(3)
Expand Down Expand Up @@ -1357,16 +1357,16 @@ def test_no_jump_between_except_blocks_2(output):
output.append(7)
output.append(8)

@jump_test(1, 5, [], (ValueError, "into a 'finally'"))
def test_no_jump_into_finally_block(output):
@jump_test(1, 5, [5])
def test_jump_into_finally_block(output):
output.append(1)
try:
output.append(3)
finally:
output.append(5)

@jump_test(3, 6, [2, 5, 6], (ValueError, "into a 'finally'"))
def test_no_jump_into_finally_block_from_try_block(output):
@jump_test(3, 6, [2, 6, 7])
def test_jump_into_finally_block_from_try_block(output):
try:
output.append(2)
output.append(3)
Expand All @@ -1375,8 +1375,8 @@ def test_no_jump_into_finally_block_from_try_block(output):
output.append(6)
output.append(7)

@jump_test(5, 1, [1, 3], (ValueError, "out of a 'finally'"))
def test_no_jump_out_of_finally_block(output):
@jump_test(5, 1, [1, 3, 1, 3, 5])
def test_jump_out_of_finally_block(output):
output.append(1)
try:
output.append(3)
Expand Down Expand Up @@ -1441,23 +1441,23 @@ def test_no_jump_out_of_qualified_except_block(output):
output.append(6)
output.append(7)

@jump_test(3, 5, [1, 2, -2], (ValueError, 'into'))
def test_no_jump_between_with_blocks(output):
@jump_test(3, 5, [1, 2, 5, -2])
def test_jump_between_with_blocks(output):
output.append(1)
with tracecontext(output, 2):
output.append(3)
with tracecontext(output, 4):
output.append(5)

@async_jump_test(3, 5, [1, 2, -2], (ValueError, 'into'))
async def test_no_jump_between_async_with_blocks(output):
@async_jump_test(3, 5, [1, 2, 5, -2])
async def test_jump_between_async_with_blocks(output):
output.append(1)
async with asynctracecontext(output, 2):
output.append(3)
async with asynctracecontext(output, 4):
output.append(5)

@jump_test(5, 7, [2, 4], (ValueError, 'finally'))
@jump_test(5, 7, [2, 4], (ValueError, "unreachable"))
def test_no_jump_over_return_out_of_finally_block(output):
try:
output.append(2)
Expand Down Expand Up @@ -1551,9 +1551,8 @@ def test_no_jump_from_exception_event(output):
output.append(1)
1 / 0

@jump_test(3, 2, [2], event='return', error=(ValueError,
"can't jump from a 'yield' statement"))
def test_no_jump_from_yield(output):
@jump_test(3, 2, [2, 5], event='return')
def test_jump_from_yield(output):
def gen():
output.append(2)
yield 3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Setting frame.f_lineno is now robust w.r.t. changes in the source-to-bytecode compiler
Loading