@@ -1516,7 +1516,7 @@ def test_next_until_return_at_return_event():
1516
1516
> <doctest test.test_pdb.test_next_until_return_at_return_event[1]>(3)test_function()
1517
1517
-> test_function_2()
1518
1518
(Pdb) break test_function_2
1519
- Breakpoint 1 at <doctest test.test_pdb.test_next_until_return_at_return_event[0]>:1
1519
+ Breakpoint 1 at <doctest test.test_pdb.test_next_until_return_at_return_event[0]>:2
1520
1520
(Pdb) continue
1521
1521
> <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(2)test_function_2()
1522
1522
-> x = 1
@@ -1938,7 +1938,7 @@ def test_pdb_next_command_in_generator_for_loop():
1938
1938
> <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
1939
1939
-> for i in test_gen():
1940
1940
(Pdb) break test_gen
1941
- Breakpoint 1 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
1941
+ Breakpoint 1 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:2
1942
1942
(Pdb) continue
1943
1943
> <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(2)test_gen()
1944
1944
-> yield 0
@@ -2350,6 +2350,48 @@ def test_pdb_ambiguous_statements():
2350
2350
(Pdb) continue
2351
2351
"""
2352
2352
2353
+ def test_pdb_function_break ():
2354
+ """Testing the line number of break on function
2355
+
2356
+ >>> def foo(): pass
2357
+
2358
+ >>> def bar():
2359
+ ...
2360
+ ... pass
2361
+
2362
+ >>> def boo():
2363
+ ... # comments
2364
+ ... global x
2365
+ ... x = 1
2366
+
2367
+ >>> def gen():
2368
+ ... yield 42
2369
+
2370
+ >>> def test_function():
2371
+ ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
2372
+ ... pass
2373
+
2374
+ >>> with PdbTestInput([ # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
2375
+ ... 'break foo',
2376
+ ... 'break bar',
2377
+ ... 'break boo',
2378
+ ... 'break gen',
2379
+ ... 'continue'
2380
+ ... ]):
2381
+ ... test_function()
2382
+ > <doctest test.test_pdb.test_pdb_function_break[4]>(3)test_function()
2383
+ -> pass
2384
+ (Pdb) break foo
2385
+ Breakpoint ... at <doctest test.test_pdb.test_pdb_function_break[0]>:1
2386
+ (Pdb) break bar
2387
+ Breakpoint ... at <doctest test.test_pdb.test_pdb_function_break[1]>:3
2388
+ (Pdb) break boo
2389
+ Breakpoint ... at <doctest test.test_pdb.test_pdb_function_break[2]>:4
2390
+ (Pdb) break gen
2391
+ Breakpoint ... at <doctest test.test_pdb.test_pdb_function_break[3]>:2
2392
+ (Pdb) continue
2393
+ """
2394
+
2353
2395
def test_pdb_issue_gh_65052 ():
2354
2396
"""See GH-65052
2355
2397
0 commit comments