bootstrap: add explicit UTF-8 encoding to text-mode open() calls#152536
Conversation
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
If the script sets |
|
And please @ozankenangungor don't invoke Copilot in this project. |
|
Apologies, I won’t invoke Copilot again in this repository. Regarding the change: my understanding was that the issue aimed to avoid relying on the platform/locale-dependent default encoding, even in text mode. For that reason, I added If this is broader than intended, I’m happy to narrow the scope to only the cases where no mode/encoding was specified. |
|
issue? what issue? |
|
I was referring to #152510. |
Looks like in the I'm fine with the change itself, however @ozankenangungor can you please double-check your PR description
This is not true and why #152485 and thus #152510 exist in the first place, because the behavior is different when you specifying an explicit UTF-8 encoding or not on Python < 3.15. We want to "alter behavior" so it doesn't randomly choke on user systems (read: Windows) with different default locales.
I don't see how that tests the Python script? The change itself seems fine, just that @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
Since the associated issue #152510 has been closed as not planned, Thanks for the review and clarification. |
|
@ozankenangungor sorry, to be clear, I'm fine with the changes in this PR (just with slightly fixed PR description), I closed the issue as not-planned because it's not super accurate. Your change might potentially help if user is using Windows with non-UTF-8 locale plus they are using Python < 3.15 (which is still in pre-release, plus some users will be stuck on < 3.15 for a while anyway). |
|
Thanks for the clarification. I assumed that since the issue was closed as not planned, the PR was no longer desired that was my mistake. I will reopen the PR and adjust the description. |
…-open-encoding, r=jieyouxu bootstrap: add explicit UTF-8 encoding to text-mode open() calls Make text-mode `open()` calls in `bootstrap.py` explicitly use `encoding="utf-8"`. This avoids relying on platform-dependent default encodings when running Python < 3.15. Binary-mode opens remain unchanged.
…-open-encoding, r=jieyouxu bootstrap: add explicit UTF-8 encoding to text-mode open() calls Make text-mode `open()` calls in `bootstrap.py` explicitly use `encoding="utf-8"`. This avoids relying on platform-dependent default encodings when running Python < 3.15. Binary-mode opens remain unchanged.
…uwer Rollup of 14 pull requests Successful merges: - #152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`) - #152469 (Remove unused features) - #152515 (Extract `DepKindVTable` constructors to their own module) - #152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers) - #152218 (Report unconstrained region in hidden types lazily) - #152356 (Improve the `inline_fluent!` macro) - #152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics) - #152407 (Add regression test for type_const with unit struct ctor under mGCA) - #152440 (Fix typos and grammar in compiler and build documentation) - #152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls) - #152554 (Remove `deprecated_safe` and its corresponding feature gate) - #152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2) - #152563 (Replace "bug" with "issue" in triagebot ping messages) - #152565 (fix missleading error for tuple ctor) Failed merges: - #152512 (core: Implement feature `float_exact_integer_constants`) - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
…uwer Rollup of 14 pull requests Successful merges: - #152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`) - #152469 (Remove unused features) - #152515 (Extract `DepKindVTable` constructors to their own module) - #152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers) - #152218 (Report unconstrained region in hidden types lazily) - #152356 (Improve the `inline_fluent!` macro) - #152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics) - #152407 (Add regression test for type_const with unit struct ctor under mGCA) - #152440 (Fix typos and grammar in compiler and build documentation) - #152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls) - #152554 (Remove `deprecated_safe` and its corresponding feature gate) - #152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2) - #152563 (Replace "bug" with "issue" in triagebot ping messages) - #152565 (fix missleading error for tuple ctor) Failed merges: - #152512 (core: Implement feature `float_exact_integer_constants`) - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
Rollup merge of #152536 - ozankenangungor:bootstrap-explicit-open-encoding, r=jieyouxu bootstrap: add explicit UTF-8 encoding to text-mode open() calls Make text-mode `open()` calls in `bootstrap.py` explicitly use `encoding="utf-8"`. This avoids relying on platform-dependent default encodings when running Python < 3.15. Binary-mode opens remain unchanged.
Make text-mode
open()calls inbootstrap.pyexplicitly use
encoding="utf-8".This avoids relying on platform-dependent default encodings
when running Python < 3.15.
Binary-mode opens remain unchanged.