]> granicus.if.org Git - python/commitdiff
bpo-37785: Fix xgettext warning in argparse (GH-15161)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 13 Sep 2019 09:45:27 +0000 (02:45 -0700)
committerGitHub <noreply@github.com>
Fri, 13 Sep 2019 09:45:27 +0000 (02:45 -0700)
(cherry picked from commit 42671aea2db6cbc54369617da0fd3545048e0a45)

Co-authored-by: Jakub KulĂ­k <Kulikjak@gmail.com>
Lib/argparse.py
Misc/NEWS.d/next/Library/2019-08-07-14-49-22.bpo-37785.y7OlT8.rst [new file with mode: 0644]

index 456ec8bb7fc86a0c859f9e14407a81ab590a1236..e590225c8eb8d33adb76ae1af23d9dde1cfdc35c 100644 (file)
@@ -1214,8 +1214,9 @@ class FileType(object):
             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 (file)
index 0000000..2d3aa4f
--- /dev/null
@@ -0,0 +1 @@
+Fix xgettext warnings in :mod:`argparse`.