Skip to content

Commit 306368c

Browse files
[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 d3c76df) Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
1 parent cf06f59 commit 306368c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Lib/argparse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,8 +1847,8 @@ def add_subparsers(self, **kwargs):
18471847
kwargs.setdefault('parser_class', type(self))
18481848

18491849
if 'title' in kwargs or 'description' in kwargs:
1850-
title = _(kwargs.pop('title', 'subcommands'))
1851-
description = _(kwargs.pop('description', None))
1850+
title = kwargs.pop('title', _('subcommands'))
1851+
description = kwargs.pop('description', None)
18521852
self._subparsers = self.add_argument_group(title, description)
18531853
else:
18541854
self._subparsers = self._positionals
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Do not translate user-provided strings in :class:`argparse.ArgumentParser`.

0 commit comments

Comments
 (0)