Skip to content

Commit 062ffa4

Browse files
committed
Get frame.setlineno working again.
1 parent e7a9221 commit 062ffa4

File tree

2 files changed

+147
-114
lines changed

2 files changed

+147
-114
lines changed

Lib/test/test_sys_settrace.py

+28-28
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ def test_jump_out_of_block_backwards(output):
12521252
output.append(6)
12531253
output.append(7)
12541254

1255-
@async_jump_test(4, 5, [3, 5])
1255+
@async_jump_test(4, 5, [3], (ValueError, 'into'))
12561256
async def test_jump_out_of_async_for_block_forwards(output):
12571257
for i in [1]:
12581258
async for i in asynciter([1, 2]):
@@ -1294,7 +1294,7 @@ def test_jump_in_nested_finally(output):
12941294
output.append(8)
12951295
output.append(9)
12961296

1297-
@jump_test(6, 7, [2, 7], (ZeroDivisionError, ''))
1297+
@jump_test(6, 7, [2], (ValueError, 'within'))
12981298
def test_jump_in_nested_finally_2(output):
12991299
try:
13001300
output.append(2)
@@ -1305,7 +1305,7 @@ def test_jump_in_nested_finally_2(output):
13051305
output.append(7)
13061306
output.append(8)
13071307

1308-
@jump_test(6, 11, [2, 11], (ZeroDivisionError, ''))
1308+
@jump_test(6, 11, [2], (ValueError, 'within'))
13091309
def test_jump_in_nested_finally_3(output):
13101310
try:
13111311
output.append(2)
@@ -1320,7 +1320,7 @@ def test_jump_in_nested_finally_3(output):
13201320
output.append(11)
13211321
output.append(12)
13221322

1323-
@jump_test(5, 11, [2, 4], (ValueError, 'after'))
1323+
@jump_test(5, 11, [2, 4], (ValueError, 'exception'))
13241324
def test_no_jump_over_return_try_finally_in_finally_block(output):
13251325
try:
13261326
output.append(2)
@@ -1416,8 +1416,8 @@ def test_jump_backwards_out_of_try_except_block(output):
14161416
output.append(5)
14171417
raise
14181418

1419-
@jump_test(5, 7, [4, 7, 8])
1420-
def test_jump_between_except_blocks(output):
1419+
@jump_test(5, 7, [4], (ValueError, 'within'))
1420+
def test_no_jump_between_except_blocks(output):
14211421
try:
14221422
1/0
14231423
except ZeroDivisionError:
@@ -1427,8 +1427,8 @@ def test_jump_between_except_blocks(output):
14271427
output.append(7)
14281428
output.append(8)
14291429

1430-
@jump_test(5, 6, [4, 6, 7])
1431-
def test_jump_within_except_block(output):
1430+
@jump_test(5, 6, [4], (ValueError, 'within'))
1431+
def test_no_jump_within_except_block(output):
14321432
try:
14331433
1/0
14341434
except:
@@ -1653,63 +1653,63 @@ def test_no_jump_backwards_into_for_block(output):
16531653
output.append(2)
16541654
output.append(3)
16551655

1656-
@async_jump_test(3, 2, [2, 2], (ValueError, 'into'))
1656+
@async_jump_test(3, 2, [2, 2], (ValueError, 'within'))
16571657
async def test_no_jump_backwards_into_async_for_block(output):
16581658
async for i in asynciter([1, 2]):
16591659
output.append(2)
16601660
output.append(3)
16611661

1662-
@jump_test(1, 3, [], (ValueError, 'into'))
1662+
@jump_test(1, 3, [], (ValueError, 'depth'))
16631663
def test_no_jump_forwards_into_with_block(output):
16641664
output.append(1)
16651665
with tracecontext(output, 2):
16661666
output.append(3)
16671667

1668-
@async_jump_test(1, 3, [], (ValueError, 'into'))
1668+
@async_jump_test(1, 3, [], (ValueError, 'depth'))
16691669
async def test_no_jump_forwards_into_async_with_block(output):
16701670
output.append(1)
16711671
async with asynctracecontext(output, 2):
16721672
output.append(3)
16731673

1674-
@jump_test(3, 2, [1, 2, -1], (ValueError, 'into'))
1674+
@jump_test(3, 2, [1, 2, -1], (ValueError, 'depth'))
16751675
def test_no_jump_backwards_into_with_block(output):
16761676
with tracecontext(output, 1):
16771677
output.append(2)
16781678
output.append(3)
16791679

1680-
@async_jump_test(3, 2, [1, 2, -1], (ValueError, 'into'))
1680+
@async_jump_test(3, 2, [1, 2, -1], (ValueError, 'depth'))
16811681
async def test_no_jump_backwards_into_async_with_block(output):
16821682
async with asynctracecontext(output, 1):
16831683
output.append(2)
16841684
output.append(3)
16851685

1686-
@jump_test(1, 3, [], (ValueError, 'into'))
1687-
def test_no_jump_forwards_into_try_finally_block(output):
1686+
@jump_test(1, 3, [3, 5])
1687+
def test_jump_forwards_into_try_finally_block(output):
16881688
output.append(1)
16891689
try:
16901690
output.append(3)
16911691
finally:
16921692
output.append(5)
16931693

1694-
@jump_test(5, 2, [2, 4], (ValueError, 'into'))
1695-
def test_no_jump_backwards_into_try_finally_block(output):
1694+
@jump_test(5, 2, [2, 4, 2, 4, 5])
1695+
def test_jump_backwards_into_try_finally_block(output):
16961696
try:
16971697
output.append(2)
16981698
finally:
16991699
output.append(4)
17001700
output.append(5)
17011701

1702-
@jump_test(1, 3, [], (ValueError, 'into'))
1703-
def test_no_jump_forwards_into_try_except_block(output):
1702+
@jump_test(1, 3, [3])
1703+
def test_jump_forwards_into_try_except_block(output):
17041704
output.append(1)
17051705
try:
17061706
output.append(3)
17071707
except:
17081708
output.append(5)
17091709
raise
17101710

1711-
@jump_test(6, 2, [2], (ValueError, 'into'))
1712-
def test_no_jump_backwards_into_try_except_block(output):
1711+
@jump_test(6, 2, [2, 2, 6])
1712+
def test_jump_backwards_into_try_except_block(output):
17131713
try:
17141714
output.append(2)
17151715
except:
@@ -1718,7 +1718,7 @@ def test_no_jump_backwards_into_try_except_block(output):
17181718
output.append(6)
17191719

17201720
# 'except' with a variable creates an implicit finally block
1721-
@jump_test(5, 7, [4], (ValueError, 'into'))
1721+
@jump_test(5, 7, [4], (ValueError, 'within'))
17221722
def test_no_jump_between_except_blocks_2(output):
17231723
try:
17241724
1/0
@@ -1755,23 +1755,23 @@ def test_jump_out_of_finally_block(output):
17551755
finally:
17561756
output.append(5)
17571757

1758-
@jump_test(1, 5, [], (ValueError, "into an 'except'"))
1758+
@jump_test(1, 5, [], (ValueError, "into an exception"))
17591759
def test_no_jump_into_bare_except_block(output):
17601760
output.append(1)
17611761
try:
17621762
output.append(3)
17631763
except:
17641764
output.append(5)
17651765

1766-
@jump_test(1, 5, [], (ValueError, "into an 'except'"))
1766+
@jump_test(1, 5, [], (ValueError, "into an exception"))
17671767
def test_no_jump_into_qualified_except_block(output):
17681768
output.append(1)
17691769
try:
17701770
output.append(3)
17711771
except Exception:
17721772
output.append(5)
17731773

1774-
@jump_test(3, 6, [2, 5, 6], (ValueError, "into an 'except'"))
1774+
@jump_test(3, 6, [2, 5, 6], (ValueError, "into an exception"))
17751775
def test_no_jump_into_bare_except_block_from_try_block(output):
17761776
try:
17771777
output.append(2)
@@ -1782,7 +1782,7 @@ def test_no_jump_into_bare_except_block_from_try_block(output):
17821782
raise
17831783
output.append(8)
17841784

1785-
@jump_test(3, 6, [2], (ValueError, "into an 'except'"))
1785+
@jump_test(3, 6, [2], (ValueError, "into an exception"))
17861786
def test_no_jump_into_qualified_except_block_from_try_block(output):
17871787
try:
17881788
output.append(2)
@@ -1793,7 +1793,7 @@ def test_no_jump_into_qualified_except_block_from_try_block(output):
17931793
raise
17941794
output.append(8)
17951795

1796-
@jump_test(7, 1, [1, 3, 6], (ValueError, "out of an 'except'"))
1796+
@jump_test(7, 1, [1, 3, 6], (ValueError, "within"))
17971797
def test_no_jump_out_of_bare_except_block(output):
17981798
output.append(1)
17991799
try:
@@ -1803,7 +1803,7 @@ def test_no_jump_out_of_bare_except_block(output):
18031803
output.append(6)
18041804
output.append(7)
18051805

1806-
@jump_test(7, 1, [1, 3, 6], (ValueError, "out of an 'except'"))
1806+
@jump_test(7, 1, [1, 3, 6], (ValueError, "within"))
18071807
def test_no_jump_out_of_qualified_except_block(output):
18081808
output.append(1)
18091809
try:

0 commit comments

Comments
 (0)