https://github.com/python/cpython/commit/74367077b81880fbfc0d5c91a57df98e8282ac1a
commit: 74367077b81880fbfc0d5c91a57df98e8282ac1a
branch: main
author: tonghuaroot (童话) <[email protected]>
committer: gaogaotiantian <[email protected]>
date: 2026-10-20T12:50:08-07:00
summary:
gh-152373: Make pdb "until" step over a list comprehension with a breakpoint
(#152374)
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 f0601913ab3c8d..d654f27e5b90e0 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 8876b3f5ce37a3..8a9c55838ededb 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]