https://github.com/python/cpython/commit/6a23dc7b41686a5e720a7b26d041a1b16ca2b409 commit: 6a23dc7b41686a5e720a7b26d041a1b16ca2b409 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: gaogaotiantian <[email protected]> date: 2026-10-20T21:54:44Z summary:
[3.15] gh-152373: Make pdb "until" step over a list comprehension with a breakpoint (GH-152374) (#159957) gh-152373: Make pdb "until" step over a list comprehension with a breakpoint (GH-152374) (cherry picked from commit 74367077b81880fbfc0d5c91a57df98e8282ac1a) Co-authored-by: tonghuaroot (童话) <[email protected]> files: A Misc/NEWS.d/next/Library/2026-06-27-08-31-30.gh-issue-152373.3cd0aa.rst M Lib/bdb.py M Lib/test/test_pdb.py diff --git a/Lib/bdb.py b/Lib/bdb.py index 0ed8379bac8c1b..d969dcfe3acde5 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -572,7 +572,8 @@ def set_until(self, frame, lineno=None): # the name "until" is borrowed from gdb if lineno is None: lineno = frame.f_lineno + 1 - self._set_stopinfo(frame, frame, lineno) + self._set_stopinfo(frame, frame, lineno, + cmdframe=frame, cmdlineno=frame.f_lineno) def set_step(self): """Stop after one line of code.""" diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 5f2d3f87ba2499..d8f022a6f718c2 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -3264,6 +3264,35 @@ def test_pdb_issue_gh_136057(): """ +def test_pdb_until_skip_comprehension(): + """See GH-152373 + "until" should get over a list comprehension with a breakpoint set on it + >>> def test_function(): + ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + ... lst = [i for i in range(10)] + ... for i in lst: pass + + >>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE + ... 'break 3', + ... 'continue', + ... 'until', + ... 'continue', + ... ]): + ... test_function() + > <doctest test.test_pdb.test_pdb_until_skip_comprehension[0]>(2)test_function() + -> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + (Pdb) break 3 + Breakpoint 1 at <doctest test.test_pdb.test_pdb_until_skip_comprehension[0]>:3 + (Pdb) continue + > <doctest test.test_pdb.test_pdb_until_skip_comprehension[0]>(3)test_function() + -> lst = [i for i in range(10)] + (Pdb) until + > <doctest test.test_pdb.test_pdb_until_skip_comprehension[0]>(4)test_function() + -> for i in lst: pass + (Pdb) continue + """ + + def test_pdb_issue_gh_80731(): """See GH-80731 diff --git a/Misc/NEWS.d/next/Library/2026-06-27-08-31-30.gh-issue-152373.3cd0aa.rst b/Misc/NEWS.d/next/Library/2026-06-27-08-31-30.gh-issue-152373.3cd0aa.rst new file mode 100644 index 00000000000000..bf6a70c1374a0d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-06-27-08-31-30.gh-issue-152373.3cd0aa.rst @@ -0,0 +1,2 @@ +Fix the :mod:`pdb` ``until`` command not stepping over a list comprehension +when a breakpoint is set on it. Patch by tonghuaroot. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
