FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p by ambv · Pull Request #154469 · python/cpython · GitHub

/ cpython Public

gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p - #154469

Merged
ambv merged 1 commit into
python:mainfrom
ambv:gh-154467-pdb-remote-prompt
Jul 27, 2026
Merged

gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p#154469
ambv merged 1 commit into
python:mainfrom
ambv:gh-154467-pdb-remote-prompt

Conversation

ambv commented Jul 22, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

_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) ".

This was broken by gh-145379.

…ith pdb -p

_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) ".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ambv force-pushed the gh-154467-pdb-remote-prompt branch from 04ca7e3 to 98a07de Compare July 22, 2026 11:25
ambv merged commit 1ec5607 into python:main Jul 27, 2026
50 checks passed
mbeijen pushed a commit to mbeijen/cpython that referenced this pull request Aug 14, 2026
…ith pdb -p (python#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) ".

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
parulgupta1004 added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 26, 2026

Copy link
Copy Markdown

Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

bedevere-app Bot commented Aug 26, 2026

Copy link
Copy Markdown

GH-156397 is a backport of this pull request to the 3.15 branch.

bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 26, 2026

Copy link
Copy Markdown
Member

This needs a backport to 3.15. Details here: #154467 (comment)

ambv added a commit that referenced this pull request Aug 26, 2026
…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 1ec5607)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Fedora Stable Refleaks 3.15 (tier-2) has failed when building commit b18a8b6.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/2038/builds/312) and take a look at the build logs.
  4. Check if the failure is related to this commit (b18a8b6) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/2038/builds/312

Summary of the results of the build (if available):

Click to see traceback logs
Previous HEAD position was cfaf610d391 [3.15] gh-154085: Avoid duplicating diff line values (GH-154099) (#156385)
HEAD is now at b18a8b6b0af [3.15] gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p (GH-154469) (GH-156397)
Switched to and reset branch '3.15'

ar: unable to copy file 'libpython3.15d.a'; reason: No space left on device
make: *** [Makefile:1199: libpython3.15d.a] Error 1
make: *** Waiting for unfinished jobs....

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL