bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667)

Call _() on literal strings only.
This commit is contained in:
Jérémie Detrey 2024-09-24 21:54:50 +02:00 committed by GitHub
parent af8403a58d
commit d3c76dff44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -1804,8 +1804,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
kwargs.setdefault('parser_class', type(self))
if 'title' in kwargs or 'description' in kwargs:
title = _(kwargs.pop('title', 'subcommands'))
description = _(kwargs.pop('description', None))
title = kwargs.pop('title', _('subcommands'))
description = kwargs.pop('description', None)
self._subparsers = self.add_argument_group(title, description)
else:
self._subparsers = self._positionals

View File

@ -0,0 +1 @@
Do not translate user-provided strings in :class:`argparse.ArgumentParser`.