[Python-checkins] bpo-37785: Fix xgettext warning in argparse (GH-15161)

Miss Islington (bot) webhook-mailer at python.org
Fri Sep 13 05:45:31 EDT 2019


https://github.com/python/cpython/commit/8750dfe09eaec24231e19962d17d171c323794ad
commit: 8750dfe09eaec24231e19962d17d171c323794ad
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-09-13T02:45:27-07:00
summary:

bpo-37785: Fix xgettext warning in argparse (GH-15161)

(cherry picked from commit 42671aea2db6cbc54369617da0fd3545048e0a45)

Co-authored-by: Jakub Kulík <Kulikjak at gmail.com>

files:
A Misc/NEWS.d/next/Library/2019-08-07-14-49-22.bpo-37785.y7OlT8.rst
M Lib/argparse.py

diff --git a/Lib/argparse.py b/Lib/argparse.py
index 456ec8bb7fc8..e590225c8eb8 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1214,8 +1214,9 @@ def __call__(self, string):
             return open(string, self._mode, self._bufsize, self._encoding,
                         self._errors)
         except OSError as e:
-            message = _("can't open '%s': %s")
-            raise ArgumentTypeError(message % (string, e))
+            args = {'filename': string, 'error': e}
+            message = _("can't open '%(filename)s': %(error)s")
+            raise ArgumentTypeError(message % args)
 
     def __repr__(self):
         args = self._mode, self._bufsize
diff --git a/Misc/NEWS.d/next/Library/2019-08-07-14-49-22.bpo-37785.y7OlT8.rst b/Misc/NEWS.d/next/Library/2019-08-07-14-49-22.bpo-37785.y7OlT8.rst
new file mode 100644
index 000000000000..2d3aa4f9a75a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-08-07-14-49-22.bpo-37785.y7OlT8.rst
@@ -0,0 +1 @@
+Fix xgettext warnings in :mod:`argparse`.



More information about the Python-checkins mailing list