Skip to content

msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary #53950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
timothytylee mannequin opened this issue Sep 2, 2010 · 6 comments
Open

msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary #53950

timothytylee mannequin opened this issue Sep 2, 2010 · 6 comments
Assignees
Labels
triaged The issue has been accepted as valid by a triager. type-bug An unexpected behavior, bug, or error

Comments

@timothytylee
Copy link
Mannequin

timothytylee mannequin commented Sep 2, 2010

BPO 9741
Nosy @loewis, @akuchling, @ezio-melotti, @merwok
PRs
  • gh-79516: allow msgfmt.py to compile multiple input po files #10875
  • Files
  • msgfmt-clear.diff: 2 line patch to clear dictionary at start of msgfmt.make()
  • test_msgfmt.py: Test program to check behaviour before and after applying the patch
  • test1.po: 1st of 2 .po files used by test program
  • test2.po: 2nd of 2 .po files used by test program
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/merwok'
    closed_at = None
    created_at = <Date 2010-09-02.14:31:41.028>
    labels = ['type-bug']
    title = 'msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary'
    updated_at = <Date 2018-12-03.19:33:03.946>
    user = 'https://bugs.python.org/timothytylee'

    bugs.python.org fields:

    activity = <Date 2018-12-03.19:33:03.946>
    actor = 's-ball'
    assignee = 'eric.araujo'
    closed = False
    closed_date = None
    closer = None
    components = ['Demos and Tools']
    creation = <Date 2010-09-02.14:31:41.028>
    creator = 'timothy.ty.lee'
    dependencies = []
    files = ['18710', '22368', '22369', '22370']
    hgrepos = []
    issue_num = 9741
    keywords = ['patch', 'needs review']
    message_count = 5.0
    messages = ['115378', '138336', '138372', '195472', '240901']
    nosy_count = 5.0
    nosy_names = ['loewis', 'akuchling', 'ezio.melotti', 'eric.araujo', 'timothy.ty.lee']
    pr_nums = ['10875']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9741'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @timothytylee
    Copy link
    Mannequin Author

    timothytylee mannequin commented Sep 2, 2010

    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.

    @timothytylee timothytylee mannequin added the type-bug An unexpected behavior, bug, or error label Sep 2, 2010
    @merwok
    Copy link
    Member

    merwok commented Jun 14, 2011

    Thanks for the report and patch. Can you write a test?

    @merwok
    Copy link
    Member

    merwok commented Jun 15, 2011

    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.

    @merwok merwok self-assigned this Jun 15, 2011
    @ezio-melotti
    Copy link
    Member

    FWIW now we have Lib/test/test_tools.py.

    @akuchling
    Copy link
    Contributor

    É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.)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @StanFromIreland
    Copy link
    Contributor

    10 years later, are you still planning to apply the patch? I can open a PR with it if you want.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    triaged The issue has been accepted as valid by a triager. type-bug An unexpected behavior, bug, or error
    Projects
    Status: No status
    Development

    No branches or pull requests

    5 participants