Skip to content

Commit 6425443

Browse files
[3.13] bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667) (#124506)
bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667) Call _() on literal strings only. (cherry picked from commit d3c76df) Co-authored-by: Jérémie Detrey <[email protected]>
1 parent 0a57fe3 commit 6425443

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
@@ -1834,8 +1834,8 @@ def add_subparsers(self, **kwargs):
18341834
kwargs.setdefault('parser_class', type(self))
18351835

18361836
if 'title' in kwargs or 'description' in kwargs:
1837-
title = _(kwargs.pop('title', 'subcommands'))
1838-
description = _(kwargs.pop('description', None))
1837+
title = kwargs.pop('title', _('subcommands'))
1838+
description = kwargs.pop('description', None)
18391839
self._subparsers = self.add_argument_group(title, description)
18401840
else:
18411841
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)