Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-104783: locale.getlocale() calls sys.getfilesystemencoding() #105401

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
Jun 6, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 6, 2023

locale.getlocale() always calls sys.getfilesystemencoding(), instead of calling it only once.

locale.getlocale() always calls sys.getfilesystemencoding(), instead
of calling it only once.
@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

@methane: I added _encoding variable to be able to calle locale.getencoding() during Python finalization, when modules attributes are set to None. But maybe it's not needed. By the way, Python tries to keep sys attributes as long as posible. So I wrote this PR to change it :-)

@vstinner vstinner enabled auto-merge (squash) June 6, 2023 18:07
@vstinner vstinner merged commit 221d703 into python:main Jun 6, 2023
@vstinner vstinner deleted the locale_getencoding_call branch June 14, 2023 15:38
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.

3 participants