pdb: "until" does not step over a list comprehension with a breakpoint set on it
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
When a breakpoint is set on a line that holds a list comprehension (or any
single-line loop), the until command stops on that same line again on every
iteration instead of moving past it.
Reproduction:
# repro.py
def f():
lst = [i for i in range(10)]
for i in lst: pass
f()
$ python -m pdb repro.py
> repro.py(1)<module>()
-> def f():
(Pdb) break 2
Breakpoint 1 at repro.py:2
(Pdb) continue
> repro.py(2)f()
-> lst = [i for i in range(10)]
(Pdb) until
> repro.py(2)f()
-> lst = [i for i in range(10)]
(Pdb) until
> repro.py(2)f()
-> lst = [i for i in range(10)]
until keeps stopping on line 2, once per comprehension element.
Expected: until moves past the comprehension to the next line, the way next
and step already do (gh-136057, gh-136160). This also matches gdb, which
pdb's until is borrowed from: there, until steps past a single-line loop
to the next line even with a breakpoint set on it, instead of stopping on each
iteration.
I have a small fix for this and can open a PR.
Linked PRs
- gh-152374
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem pdb-Einstiegspunkt und reproduziere das Verhalten mit repro.py, setze einen Breakpoint in der Zeile mit der List-Comprehension und führe wiederholt until aus. Vergleiche until mit next und step, wie im Issue beschrieben. Als erledigt gilt die Aufgabe, wenn until zur nächsten Zeile weitergeht, statt bei jedem Element der Comprehension anzuhalten; ein verknüpfter PR ist bereits vermerkt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 25/100