Skip to content

gh-156577: Reject metavar for argparse store_const-like actions - #163012

Open
picnixz wants to merge 1 commit into
python:mainfrom
picnixz:gh-156577-argparse-metavar-nargs0
Open

picnixz wants to merge 1 commit into
python:mainfrom
picnixz:gh-156577-argparse-metavar-nargs0

Conversation

@picnixz

@picnixz picnixz commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

…true` and `store_false` actions

These actions consume no command-line argument, so a metavar has nothing
to name. `add_argument()` now raises `ValueError` when `metavar` is given
with them, instead of silently ignoring it (`store_const`) or failing with
a `TypeError` from the action signature (`store_true`, `store_false`).
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.

1 participant