Skip to content

argparse: Unexpanded replacements in "unknown action" exception #134970

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mgorny opened this issue May 31, 2025 · 0 comments
Closed

argparse: Unexpanded replacements in "unknown action" exception #134970

mgorny opened this issue May 31, 2025 · 0 comments
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mgorny
Copy link
Contributor

mgorny commented May 31, 2025

Bug report

Bug description:

cpython/Lib/argparse.py

Lines 1536 to 1537 in ad39f01

if not callable(action_class):
raise ValueError('unknown action {action_class!r}')

There is a missing f there, so the replacements don't happen. Noticed accidentally because it broke snakeoil's test suite.

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

Linux

Linked PRs

@mgorny mgorny added the type-bug An unexpected behavior, bug, or error label May 31, 2025
mgorny added a commit to mgorny/cpython that referenced this issue May 31, 2025
Fix the "unknown action" exception
in `argparse.ArgumentParser.add_argument_group()` to correctly replace
the action class.
@ZeroIntensity ZeroIntensity added stdlib Python modules in the Lib dir 3.13 bugs and security fixes 3.14 bugs and security fixes 3.15 new features, bugs and security fixes labels May 31, 2025
serhiy-storchaka pushed a commit that referenced this issue Jun 1, 2025
Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 1, 2025
…34971)

Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
(cherry picked from commit 965c480)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
@serhiy-storchaka serhiy-storchaka removed the 3.13 bugs and security fixes label Jun 1, 2025
serhiy-storchaka pushed a commit that referenced this issue Jun 1, 2025
GH-134991)

Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
(cherry picked from commit 965c480)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
@github-project-automation github-project-automation bot moved this to Doc issues in Argparse issues Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
Status: Doc issues
Development

No branches or pull requests

3 participants