GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@ambv ambv commented Jul 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

  • Issue: pdb -p does not display the (Pdb) prompt #154467

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
@ambv
ambv requested a review from gaogaotiantian as a code owner July 22, 2026 11:18
@bedevere-app bedevere-app Bot added the awaiting core review label Jul 22, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Jul 22, 2026
pdb -p does not display the (Pdb) prompt #154467
Closed
@ambv @claude
pythongh-154467: Fix empty (Pdb) prompt when attaching to a process w…
98a07de
…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]>
@ambv
ambv force-pushed the gh-154467-pdb-remote-prompt branch from 04ca7e3 to 98a07de Compare July 22, 2026 11:25
@ambv
ambv merged commit 1ec5607 into python:main Jul 27, 2026
50 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Jul 27, 2026
mbeijen pushed a commit to mbeijen/cpython that referenced this pull request Aug 14, 2026
@ambv @claude @mbeijen
pythongh-154467: Fix empty (Pdb) prompt when attaching to a process w…
2a0f0db
…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]>
@parulgupta1004 parulgupta1004 added the needs backport to 3.15 bugs and security fixes label Aug 26, 2026
@miss-islington-app

miss-islington-app Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Aug 26, 2026
@parulgupta1004

parulgupta1004 commented Aug 26, 2026

Copy link
Copy Markdown
Member

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

All reactions

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
@miss-islington @ambv @claude
[3.15] gh-154467: Fix empty (Pdb) prompt when attaching to a process …
b18a8b6
…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]>
@bedevere-bot

bedevere-bot commented Aug 26, 2026

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....
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gaogaotiantian 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

Labels

None yet

Projects

None yet

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.

3 participants

@ambv @parulgupta1004 @bedevere-bot
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.