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-145378: Generate consistent colors for pdb commands by gaogaotiantian · Pull Request #149305 · python/cpython

Conversation

@gaogaotiantian

@gaogaotiantian gaogaotiantian commented May 3, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

We supported pyrepl for pdb input. We used the default pyrepl color scheme which works most of the time. However, for pdb commands, they are not recognized. There are also some pdb commands (list, continue) that would be recognized as different things in pyrepl.

We should recognize those commands and use a consistent color for it. It's actually pretty helpful because users will (probably) realize that a = 1 won't work because a has a special color (a is a command for arg).

  • Issue: Use pyrepl as the default input console for pdb #145378

Sorry, something went wrong.

Uh oh!

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

All reactions
gaogaotiantian added 2 commits May 2, 2026 18:35
@gaogaotiantian
Generator consistent colors for pdb commands
3ade678
@gaogaotiantian
Move buffer change inside if
544f497
@bedevere-app bedevere-app Bot mentioned this pull request May 3, 2026
Use pyrepl as the default input console for pdb #145378
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label May 3, 2026
@blurb-it
📜🤖 Added by blurb_it.
7d89870
@corona10 corona10 self-assigned this May 3, 2026
@read-the-docs-community

read-the-docs-community Bot commented May 3, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32512833 | 📁 Comparing 9b5aa70 against main (c1940bc)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

  • contents.html
  • glossary.html
  • library/annotationlib.html
  • library/python.html
  • whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

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

@gaogaotiantian
Fix test
9b5aa70
corona10
corona10 reviewed May 3, 2026
View reviewed changes
Comment thread Lib/pdb.py
return None

def gen_colors(self, buffer):
from _pyrepl.utils import ColorSpan, Span

@corona10 corona10 May 3, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nit comment, now we can use lazy import right?

Sorry, something went wrong.

Uh oh!

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

All reactions

@StanFromIreland StanFromIreland May 3, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the import has to be conditional per #145035. Similarly to what Hugo had to do here.

Sorry, something went wrong.

Uh oh!

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

All reactions

@gaogaotiantian gaogaotiantian May 3, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This instance itself is protected by a check for the existence of _pyrepl (_pyrepl_available). If this instance is created, then _pyrepl must exist. Having these _pyrepl related imports inside the method saves us the trouble to deal with the cases where _pyrepl does not exist. If the same class is used multiple times, lazy import might be a better options. I hope that makes sense?

Sorry, something went wrong.

Uh oh!

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

StanFromIreland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
corona10
corona10 approved these changes May 3, 2026
View reviewed changes

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels May 3, 2026
@gaogaotiantian
gaogaotiantian merged commit ddfdf9b into python:main May 5, 2026
55 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@StanFromIreland StanFromIreland StanFromIreland left review comments
@corona10 corona10 corona10 approved these changes

Uh oh!

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

Assignees

@corona10 corona10

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

@gaogaotiantian @corona10 @StanFromIreland
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 01402503 — 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.