This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary
Type: behavior Stage: patch review
Components: Demos and Tools Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: akuchling, eric.araujo, ezio.melotti, loewis, timothy.ty.lee
Priority: normal Keywords: needs review, patch

Created on 2010-09-02 14:31 by timothy.ty.lee, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
msgfmt-clear.diff timothy.ty.lee, 2010-09-02 14:31 2 line patch to clear dictionary at start of msgfmt.make()
test_msgfmt.py timothy.ty.lee, 2011-06-15 13:47 Test program to check behaviour before and after applying the patch
test1.po timothy.ty.lee, 2011-06-15 13:49 1st of 2 .po files used by test program
test2.po timothy.ty.lee, 2011-06-15 13:49 2nd of 2 .po files used by test program
Pull Requests
URL Status Linked Edit
PR 10875 open s-ball, 2018-12-03 19:33
Messages (5)
msg115378 - (view) Author: Timothy Lee (timothy.ty.lee) Date: 2010-09-02 14:31
This bug can potentially lead to generation of invalid mo files when msgfmt.make() is invoked more than once.

The bug has always been present in the source code.  The included patch should be applied to all maintained branches.
msg138336 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-14 15:48
Thanks for the report and patch.  Can you write a test?
msg138372 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-15 14:00
Thanks!  In my latest message, I had forgotten that msgfmt was in Tools, not in the standard library, and as such has no automated regression tests.  Features get added and bugs get fixed after manual testing only, so I will commit your patch (modulo the unneeded global statement) without tests (but after manual testing) unless someone objects.
msg195472 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-08-17 14:19
FWIW now we have Lib/test/test_tools.py.
msg240901 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2015-04-14 15:06
Éric: do you still want to apply this patch?

(I don't think any of the 'global MESSAGES' statements in msgfmt.py are necessary; none of those functions is doing 'MESSAGES = <something>', just calling methods or setting keys in the dictionary.)
History
Date User Action Args
2022-04-11 14:57:06adminsetgithub: 53950
2018-12-03 19:33:03s-ballsetstage: test needed -> patch review
pull_requests: + pull_request10113
2015-04-14 15:06:38akuchlingsetnosy: + akuchling
messages: + msg240901
2013-08-17 14:19:06ezio.melottisetnosy: + ezio.melotti

messages: + msg195472
versions: + Python 3.4, - Python 3.2
2011-06-15 14:00:31eric.araujosetassignee: eric.araujo
messages: + msg138372
2011-06-15 13:49:28timothy.ty.leesetfiles: + test2.po
2011-06-15 13:49:00timothy.ty.leesetfiles: + test1.po
2011-06-15 13:47:29timothy.ty.leesetfiles: + test_msgfmt.py
2011-06-14 15:48:05eric.araujosetversions: + Python 3.3, - Python 3.1
nosy: + eric.araujo

messages: + msg138336

stage: patch review -> test needed
2010-09-06 03:59:14r.david.murraysetnosy: + loewis
2010-09-02 19:19:19brian.curtinsetkeywords: + needs review
stage: patch review
versions: - Python 2.6, Python 2.5, Python 3.3
2010-09-02 14:31:41timothy.ty.leecreate