gh-134970: Fix exception message in argparse module (GH-134971)

Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
This commit is contained in:
Michał Górny 2025-06-01 07:56:56 +02:00 committed by GitHub
parent cebae977a6
commit 965c480566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -1534,7 +1534,7 @@ class _ActionsContainer(object):
action_name = kwargs.get('action')
action_class = self._pop_action_class(kwargs)
if not callable(action_class):
raise ValueError('unknown action {action_class!r}')
raise ValueError(f'unknown action {action_class!r}')
action = action_class(**kwargs)
# raise an error if action for positional argument does not

View File

@ -0,0 +1,3 @@
Fix the "unknown action" exception in
:meth:`argparse.ArgumentParser.add_argument_group` to correctly replace the
action class.