Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

GH-139862: Removecolor from HelpFormatter#142274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@savannahostrowski
Copy link
Member

@savannahostrowskisavannahostrowski commentedDec 4, 2025
edited by bedevere-appbot
Loading

After digging into this, I think that we should just remove color from being passed into HelpFormatter, since this never worked and was never documented. IMO, this should be controlled by the parser anyway.

@hugovk
Copy link
Member

(Updated frommain to fix the Android failure:#142289)

…BfsD4.rstCo-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@savannahostrowskisavannahostrowskienabled auto-merge (squash)December 5, 2025 15:48
@savannahostrowskisavannahostrowski merged commit4b14529 intopython:mainDec 5, 2025
46 checks passed
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull requestDec 6, 2025
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@hamdanal
Copy link
Contributor

This PR broke instantiating the formatter outside the parser because_theme is no longer set in__init__ as_set_color is no longer called.

importargparseformatter=argparse.HelpFormatter(prog="program")formatter.add_usage(usage=None,actions=[],groups=[])print(formatter.format_help())

This now raises anAttributeError:

Traceback (most recent call last):  File"/tmp/t.py", line5, in<module>print(formatter.format_help())~~~~~~~~~~~~~~~~~~~~~^^  File"/tmp/argparse.py", line303, informat_helphelp=self._root_section.format_help()  File"/tmp/argparse.py", line228, informat_help    item_help= join([func(*args)for func, argsinself.items])~~~~^^^^^^^  File"/tmp/argparse.py", line315, in_format_usage    t=self._theme^^^^^^^^^^^AttributeError:'HelpFormatter' object has no attribute '_theme'

This only broke a test over athttps://github.com/hamdanal/rich-argparse and I am not sure if it a supported usage of the formatter. Let me know if I need to create an issue/PR.

@savannahostrowski
Copy link
MemberAuthor

Hey@hamdanal, thanks for raising this! Direct instantiation ofHelpFormatter should continue to work. I think the fix is to callself._set_color(False) at the end of __init__ to initialize_theme with a no-color default. The parser can still override it afterward. I've put up#142384 to address this.

hamdanal reacted with heart emoji

@hugovk
Copy link
Member

@hamdanal And thank you for testing the nightly and reporting so quickly :)

hamdanal reacted with heart emoji

tacaswell added a commit to tacaswell/build that referenced this pull requestDec 8, 2025
This is broken with cpython main which removed the color keyword argumentto HelperFormatter inpython/cpython#142274
tacaswell added a commit to tacaswell/build that referenced this pull requestDec 8, 2025
This is broken with cpython main which removed the color keyword argumentto HelperFormatter inpython/cpython#142274
henryiii pushed a commit to pypa/build that referenced this pull requestDec 8, 2025
This is broken with cpython main which removed the color keyword argumentto HelperFormatter inpython/cpython#142274
@hroncok
Copy link
Contributor

Beware, this also breaks existing code that sets the color this way.

This was possible in 3.14 and now it explodes:

Python 3.14.2 (main, Dec  5 2025, 00:00:00) [GCC 15.2.1 20251111 (Red Hat 15.2.1-4)] on linuxType "help", "copyright", "credits" or "license" for more information.>>>import argparse>>> argparse.HelpFormatter(prog='',color=True)<argparse.HelpFormatter object at 0x7fd998cd1400>
Python 3.15.0a3 (main, Dec 16 2025, 00:00:00) [GCC 15.2.1 20251211 (Red Hat 15.2.1-5)] on linuxType "help", "copyright", "credits" or "license" for more information.>>>import argparse>>> argparse.HelpFormatter(prog='',color=True)Traceback (most recent call last):  File "<python-input-1>", line 1, in <module>    argparse.HelpFormatter(prog='', color=True)    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^TypeError: HelpFormatter.__init__() got an unexpected keyword argument 'color'

In particular, this breaks pypa/build beforepypa/build#962

savannahostrowski reacted with thumbs up emoji

@hroncok
Copy link
Contributor

Reported as#142928, so it is trackable.

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

Reviewers

@hugovkhugovkhugovk approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@savannahostrowski@hugovk@hamdanal@hroncok

[8]ページ先頭

©2009-2026 Movatter.jp