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

gh-145378: Generate consistent colors for pdb commands by gaogaotiantian · Pull Request #149305 · python/cpython · GitHub

Repository navigation

gh-145378: Generate consistent colors for pdb commands - #149305

Merged
gaogaotiantian merged 4 commits into
python:mainfrom
gaogaotiantian:gen-colors-for-pdb-commands
May 5, 2026
Merged

gaogaotiantian merged 4 commits into
python:mainfrom
gaogaotiantian:gen-colors-for-pdb-commands

Conversation

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

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

corona10 self-assigned this May 3, 2026

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

Copy link
Copy Markdown

Documentation build overview

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

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

Comment thread Lib/pdb.py
return None

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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?

corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

overall lgtm

gaogaotiantian merged commit ddfdf9b into python:main May 5, 2026
55 checks passed
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