Skip to content

gh-130655: Add a test for big-endian MO files in gettext #132469

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

Merged
merged 1 commit into from
May 1, 2025

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Apr 13, 2025

MO files can be stored either in little or big-endian format. Which is which is dictated by the file header.
All our test MO files are currently little-endian. We should have at least one test with big-endian as well.

@tomasr8 tomasr8 added skip news needs backport to 3.13 bugs and security fixes labels Apr 13, 2025
@bedevere-app bedevere-app bot added awaiting review tests Tests in the Lib/test dir labels Apr 13, 2025
Copy link
Contributor

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -115,6 +115,23 @@
0x62, 0x61, 0x72, 0x00, # Message data
]))


GNU_MO_DATA_BIG_ENDIAN = base64.b64encode(bytes([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird to use b64encode here, and then decode it back. In future we may use bytes literals.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, thanks for the review!

@serhiy-storchaka serhiy-storchaka merged commit 474f296 into python:main May 1, 2025
54 checks passed
@miss-islington-app
Copy link

Thanks @tomasr8 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 1, 2025
…nGH-132469)

(cherry picked from commit 474f296)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented May 1, 2025

GH-133248 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 1, 2025
serhiy-storchaka pushed a commit that referenced this pull request May 1, 2025
…32469) (GH-133248)

(cherry picked from commit 474f296)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
@tomasr8 tomasr8 deleted the gettext-bigendian branch May 1, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants