Skip to content

New REPL crash (and terminal display issues) after a breakpoint and by sending Ctrl + D input #129614

Description

@Viicos

Bug report

Bug description:

In a really specific scenario, the terminal can go crazy and becomes unresponsive:

bug.mp4

Steps to reproduce:

  • Create an issue.py file, with a breakpoint set (echo 'breakpoint()' > issue.py).
  • Run issue.py in 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 + CKeyboardInterrupt

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 + CPrograminterrupted. (Use'cont'toresume).
--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 (mostrecentcalllast):
File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line271, insigint_handlerself.set_trace(frame)
File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/bdb.py", line94, intrace_dispatchreturnself.dispatch_return(frame, arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/bdb.py", line153, indispatch_returnself.user_return(frame, arg)
File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line362, inuser_returnself.interaction(frame, None)
File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line428, ininteractionself._cmdloop()
File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/pdb.py", line390, in_cmdloopself.cmdloop()
File"/home/victorien/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/cmd.py", line126, incmdloopline=input(self.prompt)
^^^^^^^^^^^^^^^^^^RuntimeError: can'tre-enterreadline>>>

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions