From 6425443e1dc2b2051b2b2e953d719bd5f1659eb5 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 30 Sep 2024 03:03:29 +0200 Subject: [3.13] bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667) (#124506) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667) Call _() on literal strings only. (cherry picked from commit d3c76dff444046504754a437dceebc9a9c87ef18) Co-authored-by: Jérémie Detrey --- Lib/argparse.py | 4 ++-- Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2021-08-24-19-37-46.bpo-44864.KzxaDh.rst diff --git a/Lib/argparse.py b/Lib/argparse.py index bf17af0..e670962 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1834,8 +1834,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 index 0000000..9610fa9 --- /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`. -- cgit v0.12