]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers...
authorJérémie Detrey <jdetrey@users.noreply.github.com>
Tue, 24 Sep 2024 19:54:50 +0000 (21:54 +0200)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2024 19:54:50 +0000 (19:54 +0000)
Call _() on literal strings only.

Lib/argparse.py
Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst [new file with mode: 0644]

index 694c46db61d1779aff037ab9fb04572c7f0b550e..690b2a9db9481b164dd8ba180115c1be04697f13 100644 (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
diff --git a/Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst b/Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst
new file mode 100644 (file)
index 0000000..9610fa9
--- /dev/null
@@ -0,0 +1 @@
+Do not translate user-provided strings in :class:`argparse.ArgumentParser`.