Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9c7a8f

Browse files
committed
Fix incorrect use of gettext in argparse (#10497).
Steven, the maintainer of argparse, agreed to have this committed without tests for now, since the fix is obvious. See the bug log.
1 parent bed81c8 commit a9c7a8f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/argparse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ def __call__(self, parser, namespace, values, option_string=None):
10801080
parser = self._name_parser_map[parser_name]
10811081
except KeyError:
10821082
tup = parser_name, ', '.join(self._name_parser_map)
1083-
msg = _('unknown parser %r (choices: %s)' % tup)
1083+
msg = _('unknown parser %r (choices: %s)') % tup
10841084
raise ArgumentError(self, msg)
10851085

10861086
# parse all the remaining options into the namespace
@@ -1121,7 +1121,7 @@ def __call__(self, string):
11211121
elif 'w' in self._mode:
11221122
return _sys.stdout
11231123
else:
1124-
msg = _('argument "-" with mode %r' % self._mode)
1124+
msg = _('argument "-" with mode %r') % self._mode
11251125
raise ValueError(msg)
11261126

11271127
# all other arguments are used as file names

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Core and Builtins
3535
Library
3636
-------
3737

38+
- Issue #10497: Fix incorrect use of gettext in argparse.
39+
3840
- Issue #10478: Reentrant calls inside buffered IO objects (for example by
3941
way of a signal handler) now raise a RuntimeError instead of freezing the
4042
current process.

0 commit comments

Comments
 (0)