New REPL crash (and terminal display issues) after a breakpoint and by sending Ctrl + D input
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
Bug description:
In a really specific scenario, the terminal can go crazy and becomes unresponsive:
https://github.com/user-attachments/assets/d9986c12-aa66-4e3c-bc69-840af79eec95
Steps to reproduce:
- Create an
issue.pyfile, with a breakpoint set (echo 'breakpoint()' > issue.py). - Run
issue.pyin interactive mode:python -i issue.py - Press C to continue when hitting the breakpoint.
- Start typing something, e.g.
help( - Input Ctrl + D, as if you wanted to exit the terminal. Nothing happens (as it should).
- Input Ctrl + C, as if you wanted to clear the line.
If no breakpoint was hit before, this works as expected:
>>> help( # hit Ctrl + D then Ctrl + C
KeyboardInterrupt
Note trying to reproduce on Python 3.12, the following happens:
--Return--
> /home/victorien/ws/pydantic/issue.py(1)<module>()->None
-> breakpoint()
(Pdb) c
>>> help( # hit Ctrl + D then Ctrl + C
Program interrupted. (Use 'cont' to resume).
--Return--
> /home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py(271)sigint_handler()->None
-> self.set_trace(frame)
Traceback (most recent call last):
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line 271, in sigint_handler
self.set_trace(frame)
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/bdb.py", line 94, in trace_dispatch
return self.dispatch_return(frame, arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/bdb.py", line 153, in dispatch_return
self.user_return(frame, arg)
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line 362, in user_return
self.interaction(frame, None)
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line 428, in interaction
self._cmdloop()
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line 390, in _cmdloop
self.cmdloop()
File "/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/cmd.py", line 126, in cmdloop
line = input(self.prompt)
^^^^^^^^^^^^^^^^^^
RuntimeError: can't re-enter readline
>>>
CPython versions tested on:
3.13
Operating systems tested on:
Linux
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
Reproduziere die Terminalsequenz mit Python 3.13 und beginne dann damit, die readline-Interaktion anhand von pdb.py, bdb.py und cmd.py zu lesen, einschließlich des gemeldeten RuntimeError über das erneute Betreten von readline. Erledigt bedeutet, dass der Breakpoint-Ablauf die REPL nach Ctrl+D gefolgt von Ctrl+C nicht mehr unresponsiv zurücklässt oder abstürzen lässt und eine Regressionstestabdeckung für das Szenario vorhanden ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- cli, devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100