gh-85320: Use UTF-8 for IDLE configuration and breakpoint files#152475
Merged
Conversation
They were read and written using the locale encoding, which could corrupt non-ASCII paths and made them non-portable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
I intend to check later today that the change creates no problems on an existing Window installation with both config and breakpoint files. |
terryjreedy
approved these changes
Jun 29, 2026
terryjreedy
left a comment
Member
There was a problem hiding this comment.
My quick check of reading, editing, saving and using both files showed no problems.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-152555 is a backport of this pull request to the 3.15 branch. |
|
GH-152556 is a backport of this pull request to the 3.14 branch. |
|
GH-152557 is a backport of this pull request to the 3.13 branch. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
IDLE opened its configuration files (
.idlerc/config-*.cfg) and the breakpoints file without an explicit encoding, so they used the locale encoding. Non-ASCII data — such as non-ASCII paths in the breakpoints file or help-source URLs in the config — could be corrupted, and the files were not portable between environments.Read them as UTF-8 with
errors='replace'and write them as UTF-8, matching the long-standing treatment ofrecent-files.lst.Since UTF-8 mode is the default from 3.15 (PEP 686), this is mostly a no-op on current main except under
-X utf8=0; the behavioral fix matters on the 3.13 and 3.14 backports, where the locale encoding is still used.Reading with
errors='replace'instead of the locale codec also means a config file written in a different encoding no longer raisesUnicodeDecodeErrorand crashes IDLE on startup; it is decoded lossily instead. This also fixes gh-84615.