https://github.com/python/cpython/commit/306368c9c881040e383fa9f43ee671620ff133fc
commit: 306368c9c881040e383fa9f43ee671620ff133fc
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-09-25T10:28:27Z
summary:

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

Call _() on literal strings only.
(cherry picked from commit d3c76dff444046504754a437dceebc9a9c87ef18)

Co-authored-by: Jérémie Detrey <[email protected]>

files:
A Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst
M Lib/argparse.py

diff --git a/Lib/argparse.py b/Lib/argparse.py
index 19f86ed4225ab6..d0302ad4fb6fb7 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1847,8 +1847,8 @@ def add_subparsers(self, **kwargs):
         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
index 00000000000000..9610fa90ef0a98
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst
@@ -0,0 +1 @@
+Do not translate user-provided strings in :class:`argparse.ArgumentParser`.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to