Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GH-139862: Fix direct instantiation of HelpFormatter#142384

Merged
savannahostrowski merged 3 commits into
python:mainpython/cpython:mainfrom
savannahostrowski:fix-help-format-colorsavannahostrowski/cpython:fix-help-format-colorCopy head branch name to clipboard
Dec 7, 2025
Merged

GH-139862: Fix direct instantiation of HelpFormatter#142384
savannahostrowski merged 3 commits into
python:mainpython/cpython:mainfrom
savannahostrowski:fix-help-format-colorsavannahostrowski/cpython:fix-help-format-colorCopy head branch name to clipboard

Conversation

@savannahostrowski

@savannahostrowski savannahostrowski commented Dec 7, 2025

Copy link
Copy Markdown
Member

Based on #142274 (comment), the issue here is that format_help() eventually accesses self._theme but _theme was never set since _set_color() is no longer called in __init__. I think we can initialize _theme to a safe default (no color) so that direct instantiation works but the parser can still override it afterward.

@savannahostrowski

Copy link
Copy Markdown
Member Author

@hamdanal Mind also taking a look at this and making sure everything is fixed on your end?

@hamdanal hamdanal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This fixes the problem. Thank you.

@hugovk hugovk 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.

Worth adding a regression test?

@savannahostrowski savannahostrowski enabled auto-merge (squash) December 7, 2025 20:36
@savannahostrowski savannahostrowski merged commit dc9f238 into python:main Dec 7, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.