GeezerVison is showing github.com — gh-154467: Fix empty (Pdb) prompt when attaching to a process with pdb -p by ambv · Pull Request #154469 · python/cpython
Conversation
ambv
commented
Jul 22, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
_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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
parulgupta1004 reacted with thumbs up emoji
johnslavik reacted with heart emoji
All reactions
-
👍
1 reaction
-
❤️
1 reaction
…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) <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
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) <[email protected]>
|
Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
⚠️⚠️⚠️ 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:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- 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.
- Check if the failure is related to this commit (b18a8b6) or if it is a false positive.
- 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....
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
gaogaotiantian
Awaiting requested review from gaogaotiantian
gaogaotiantian is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|