Skip to content
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

gh-104783: locale.getencoding() fallback uses FS encoding #105381

Merged
merged 1 commit into from Jun 6, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 6, 2023

The locale.getencoding() function now uses
sys.getfilesystemencoding() if _locale.getencoding() is missing, instead of calling locale.getdefaultlocale().

The locale.getencoding() function now uses
sys.getfilesystemencoding() if _locale.getencoding() is missing,
instead of calling locale.getdefaultlocale().
@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

@methane: This change is more a theorical change, since it doesn't affect CPython which always has the _locale extension. But it's needed to prepare the removal of the deprecated locale.getdefaultencoding() function.

@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

I don't think that a Changelog entry is needed, since it doesn't affect CPython users.

@vstinner vstinner merged commit b1a91d2 into python:main Jun 6, 2023
20 of 21 checks passed
@vstinner vstinner deleted the fs_encoding branch June 6, 2023 14:55
# LANG not set, default to UTF-8
encoding = 'utf-8'
return encoding
return _encoding
Copy link
Member

Choose a reason for hiding this comment

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

return sys.getfilesystemencoding() would be enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

I created PR #105401 to change this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants