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
bootloader: set configure_locale=1 in interpreter pre-config #8306
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rokm
force-pushed
the
fix-user-preferred-locale
branch
from
February 17, 2024 11:50
98a7eaf
to
4726af7
Compare
bwoodsend
reviewed
Feb 17, 2024
rokm
force-pushed
the
fix-user-preferred-locale
branch
from
February 17, 2024 15:28
4726af7
to
263f048
Compare
bwoodsend
approved these changes
Feb 17, 2024
Hmm, looks like the CI runner does not come with the extra locales. Should we adjust the workflow to install/enable them, or can we live without that part of the test? |
rokm
force-pushed
the
fix-user-preferred-locale
branch
from
February 17, 2024 17:41
263f048
to
7ef72f8
Compare
I see you've already done it but yeah, I think installing the locales on CI sounds sensible. |
bwoodsend
approved these changes
Feb 17, 2024
Have bootloader set the `configure_locale` field in the interpreter pre-config structure, so that user-preferred locale is set during interpreter pre-initialization. This fixes regression w.r.t. PyInstaller 5.x and unfrozen python, where calling `locale.getlocale` in frozen application returns user-preferred locale, while frozen applications created by PyInstaller 6.x currently return `(None, None)`. In PyInstaller 5.x bootloader, user-preferred locale was set explicitly by bootloader calling `setlocale` in C code; now, we can let python interpreter (pre)initialization handle that for us.
Add a test that ensures that user-preferred locale is set on the POSIX systems; i.e., that `locale.getlocale()` does not return `(None, None)` and that values in the tuple correspond to locale/encoding set via environment variable (`LC_ALL`).
The ubuntu CI runner does not come with any locales enabled, so we need to explicitly enable the following locales for `test_basic::test_user_preferred_locale`: - en_US.UTF-8 - en_US (= en_US.ISO8859-1) - sl_SI.UTF-8 - sl_SI (= sl_SI.ISO8859-2) In addition, `test_basic::test_time_module_localized` seems to be using `cs_CZ.UTF-8`, so enable that as well.
rokm
force-pushed
the
fix-user-preferred-locale
branch
from
February 17, 2024 22:06
7ef72f8
to
a6f3e4d
Compare
6 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Have bootloader set the
configure_locale
field in the interpreter pre-config structure, so that user-preferred locale is set during interpreter pre-initialization.This fixes regression w.r.t. PyInstaller 5.x and unfrozen python, where calling
locale.getlocale
in frozen application returns user-preferred locale, while frozen applications created by PyInstaller 6.x currently return(None, None)
. By extension, this fixes #8305.In PyInstaller 5.x bootloader, user-preferred locale was set explicitly by bootloader calling
setlocale
in C code; now, we can let python interpreter (pre)initialization handle that for us.