8000 bpo-37785: Fix xgettext warning in argparse (GH-15161) · python/cpython@8750dfe · GitHub
[go: up one dir, main page]

Skip to content

Commit 8750dfe

Browse files
bpo-37785: Fix xgettext warning in argparse (GH-15161)
(cherry picked from commit 42671ae) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
1 parent 664d56a commit 8750dfe

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/argparse.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,8 +1214,9 @@ def __call__(self, string):
12141214
return open(string, self._mode, self._bufsize, self._encoding,
12151215
self._errors)
12161216
except OSError as e:
1217-
message = _("can't open '%s': %s")
1218-
raise ArgumentTypeError(message % (string, e))
1217+
args = {'filename': string, 'error': e}
1218+
message = _("can't open '%(filename)s': %(error)s")
1219+
raise ArgumentTypeError(message % args)
12191220

12201221
def __repr__(self):
12211222
args = self._mode, self._bufsize
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix xgettext warnings in :mod:`argparse`.

0 commit comments

Comments
 (0)
0