classification
Title: argparse uses %s in gettext calls causing xgettext warnings
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: CuriousLearner, bethard, eric.araujo, kulikjak, mdk, miss-islington, paul.j3, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-08-07 12:49 by kulikjak, last changed 2019-09-13 10:33 by mdk. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 15161 merged kulikjak, 2019-08-07 12:53
PR 16080 merged miss-islington, 2019-09-13 09:25
PR 16081 merged miss-islington, 2019-09-13 09:26
PR 16082 merged mdk, 2019-09-13 09:59
Messages (12)
msg349166 - (view) Author: Jakub Kulik (kulikjak) * Date: 2019-08-07 12:49
Running xgettext on argparse.py (of any currently supported Python 3.x) return following warning:

./Lib/argparse.py: warning: 'msgid' format string with unnamed arguments cannot be properly localized: The translator cannot reorder the arguments. Please consider using a format string with named arguments, and a mapping instead of a tuple for the arguments.

Same problem was already partially fixed here: https://bugs.python.org/issue10528. I guess that this occurrence was either missed or is new since.

It would be nice to have this backported to all supported releases but considering incompatibility worries in issue linked above, it may be fixed only in 3.8+ (which is still nice).
msg349305 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2019-08-09 18:09
Hi Jakub,

Welcome and thank you for contributing. I've added a suggestion on your pull request.


Python 3.6 and Python 3.5 are in security fixes stage, so I've removed those tags from this bug.
msg349445 - (view) Author: Jakub Kulik (kulikjak) * Date: 2019-08-12 08:16
Thanks,

I see; this is not a change for security only stage. I merged your suggestion.
msg349449 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2019-08-12 08:55
Hi Eric,

This is with reference to https://bugs.python.org/issue10528.

I've looked at the PR and it's ready for a core-review: https://github.com/python/cpython/pull/15161

Can you please take a look at this?

Many thanks!
msg352251 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2019-09-13 09:25
New changeset 42671aea2db6cbc54369617da0fd3545048e0a45 by Julien Palard (Jakub Kulík) in branch 'master':
bpo-37785: Fix xgettext warning in argparse (GH-15161)
https://github.com/python/cpython/commit/42671aea2db6cbc54369617da0fd3545048e0a45
msg352256 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-09-13 09:32
It is a backward incompatible change. It will break existing translations. It should not be backported.
msg352263 - (view) Author: miss-islington (miss-islington) Date: 2019-09-13 09:44
New changeset b50eff65906f8e9b4597cb0128ea1729341346fc by Miss Islington (bot) in branch '3.7':
bpo-37785: Fix xgettext warning in argparse (GH-15161)
https://github.com/python/cpython/commit/b50eff65906f8e9b4597cb0128ea1729341346fc
msg352267 - (view) Author: miss-islington (miss-islington) Date: 2019-09-13 09:45
New changeset 8750dfe09eaec24231e19962d17d171c323794ad by Miss Islington (bot) in branch '3.8':
bpo-37785: Fix xgettext warning in argparse (GH-15161)
https://github.com/python/cpython/commit/8750dfe09eaec24231e19962d17d171c323794ad
msg352272 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-09-13 09:54
I think it would be safer to revert changes in maintained versions. At least in 3.7.
msg352274 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2019-09-13 09:55
OK to revert in 3.7, got your point.
msg352275 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2019-09-13 09:59
Thanks for noticing Serhiy!
msg352279 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2019-09-13 10:20
New changeset f14fcbf2995b43c8607a1448402633ac558a745f by Julien Palard in branch '3.7':
Revert "bpo-37785: Fix xgettext warning in argparse (GH-15161)" (GH-16082)
https://github.com/python/cpython/commit/f14fcbf2995b43c8607a1448402633ac558a745f
History
Date User Action Args
2019-09-13 10:33:59mdksetstatus: open -> closed
stage: patch review -> resolved
2019-09-13 10:20:17mdksetmessages: + msg352279
2019-09-13 09:59:54mdksetstage: resolved -> patch review
pull_requests: + pull_request15704
2019-09-13 09:59:19mdksetmessages: + msg352275
2019-09-13 09:55:53mdksetmessages: + msg352274
2019-09-13 09:54:31serhiy.storchakasetstatus: closed -> open

messages: + msg352272
2019-09-13 09:45:54mdksetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-09-13 09:45:30miss-islingtonsetmessages: + msg352267
2019-09-13 09:44:07miss-islingtonsetnosy: + miss-islington
messages: + msg352263
2019-09-13 09:32:52serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg352256
2019-09-13 09:26:02miss-islingtonsetpull_requests: + pull_request15703
2019-09-13 09:25:56miss-islingtonsetpull_requests: + pull_request15702
2019-09-13 09:25:35mdksetnosy: + mdk
messages: + msg352251
2019-08-12 10:26:02xtreaksetnosy: + paul.j3
2019-08-12 08:55:55CuriousLearnersetnosy: + bethard, eric.araujo
messages: + msg349449
2019-08-12 08:16:05kulikjaksetmessages: + msg349445
2019-08-09 18:09:02CuriousLearnersetversions: - Python 3.5, Python 3.6
nosy: + CuriousLearner

messages: + msg349305

type: behavior
2019-08-07 12:53:02kulikjaksetkeywords: + patch
stage: patch review
pull_requests: + pull_request14894
2019-08-07 12:51:34kulikjaksettitle: argparse uses %s in gettext calls -> argparse uses %s in gettext calls causing xgettext warnings
2019-08-07 12:49:16kulikjakcreate