]> granicus.if.org Git - python/commitdiff
Fix incorrect use of gettext in argparse (#10497).
authorÉric Araujo <merwok@netwok.org>
Fri, 3 Dec 2010 19:19:17 +0000 (19:19 +0000)
committerÉric Araujo <merwok@netwok.org>
Fri, 3 Dec 2010 19:19:17 +0000 (19:19 +0000)
Steven, the maintainer of argparse, agreed to have this committed
without tests for now, since the fix is obvious.  See the bug log.

Lib/argparse.py
Misc/NEWS

index 855ff5b93f8f74738d88f2b66d6a9c4d9eb62a3b..63713c6c42c3c4af9578f408ba9170b72d035fdd 100644 (file)
@@ -1080,7 +1080,7 @@ class _SubParsersAction(Action):
             parser = self._name_parser_map[parser_name]
         except KeyError:
             tup = parser_name, ', '.join(self._name_parser_map)
-            msg = _('unknown parser %r (choices: %s)' % tup)
+            msg = _('unknown parser %r (choices: %s)') % tup
             raise ArgumentError(self, msg)
 
         # parse all the remaining options into the namespace
@@ -1121,7 +1121,7 @@ class FileType(object):
             elif 'w' in self._mode:
                 return _sys.stdout
             else:
-                msg = _('argument "-" with mode %r' % self._mode)
+                msg = _('argument "-" with mode %r') % self._mode
                 raise ValueError(msg)
 
         # all other arguments are used as file names
index b0221cb9e6e9276b3c99335d38e3a20b83a9c04b..d2e4fa80f3956253c8ce4a40a2f49e91161cfa32 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -35,6 +35,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #10497: Fix incorrect use of gettext in argparse.
+
 - Issue #10478: Reentrant calls inside buffered IO objects (for example by
   way of a signal handler) now raise a RuntimeError instead of freezing the
   current process.