gh-136057: Allow step and next to step over for loops (#136160) · python/cpython@8be3b2f · GitHub
Skip to content

Commit 8be3b2f

Browse files
gh-136057: Allow step and next to step over for loops (#136160)
1 parent be699d6 commit 8be3b2f

3 files changed

Lines changed: 50 additions & 4 deletions

File tree

Lib/bdb.py

Lines changed: 18 additions & 4 deletions

Lib/test/test_pdb.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3232,6 +3232,37 @@ def test_pdb_issue_gh_127321():
32323232
"""
32333233

32343234

3235+
def test_pdb_issue_gh_136057():
3236+
"""See GH-136057
3237+
"step" and "next" commands should be able to get over list comprehensions
3238+
>>> def test_function():
3239+
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
3240+
... lst = [i for i in range(10)]
3241+
... for i in lst: pass
3242+
3243+
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
3244+
... 'next',
3245+
... 'next',
3246+
... 'step',
3247+
... 'continue',
3248+
... ]):
3249+
... test_function()
3250+
> <doctest test.test_pdb.test_pdb_issue_gh_136057[0]>(2)test_function()
3251+
-> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
3252+
(Pdb) next
3253+
> <doctest test.test_pdb.test_pdb_issue_gh_136057[0]>(3)test_function()
3254+
-> lst = [i for i in range(10)]
3255+
(Pdb) next
3256+
> <doctest test.test_pdb.test_pdb_issue_gh_136057[0]>(4)test_function()
3257+
-> for i in lst: pass
3258+
(Pdb) step
3259+
--Return--
3260+
> <doctest test.test_pdb.test_pdb_issue_gh_136057[0]>(4)test_function()->None
3261+
-> for i in lst: pass
3262+
(Pdb) continue
3263+
"""
3264+
3265+
32353266
def test_pdb_issue_gh_80731():
32363267
"""See GH-80731
32373268
Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)