cpython
b18a8b6b - [3.15] gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p (GH-154469) (GH-156397)

Commit
16 days ago
[3.15] gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p (GH-154469) (GH-156397) gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p (GH-154469) _PdbServer inherits _cmdloop, which wraps cmdloop() in _maybe_use_pyrepl_as_stdin(). That context manager blanks self.prompt to '' so that a local pyrepl draws the prompt itself. The remote server, however, never reads from a local pyrepl -- it transmits self.prompt to the client over the socket -- so the blanking made it send an empty prompt whenever the target process had a pyrepl-capable terminal (pyrepl_input is set). Override _maybe_use_pyrepl_as_stdin() in _PdbServer to a no-op, keeping the real prompt. Add an integration test that attaches to a target running under a pty, so PyREPL is genuinely enabled inside it, and asserts the transmitted prompt is "(Pdb) ". (cherry picked from commit 1ec56076642091c446ec95afcf166bb4f185f0b7) Co-authored-by: Ɓukasz Langa <lukasz@langa.pl> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Parents
Loading