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-93103: Py_DecodeLocale() uses _PyRuntime.preconfig #93187

Merged
merged 1 commit into from
May 24, 2022
Merged

gh-93103: Py_DecodeLocale() uses _PyRuntime.preconfig #93187

merged 1 commit into from
May 24, 2022

Conversation

vstinner
Copy link
Member

The Py_DecodeLocale() and Py_EncodeLocale() now use
_PyRuntime.preconfig, rather than Py_UTF8Mode and
Py_LegacyWindowsFSEncodingFlag global configuration varibles, to
decide if the UTF-8 encoding is used or not.

As documented, these functions must not be called before Python is
preinitialized. The new PyConfig API should now be used, rather than
using deprecated functions like Py_SetPath() or PySys_SetArgv().

The Py_DecodeLocale() and Py_EncodeLocale() now use
_PyRuntime.preconfig, rather than Py_UTF8Mode and
Py_LegacyWindowsFSEncodingFlag global configuration varibles, to
decide if the UTF-8 encoding is used or not.

As documented, these functions must not be called before Python is
preinitialized. The new PyConfig API should now be used, rather than
using deprecated functions like Py_SetPath() or PySys_SetArgv().
@vstinner
Copy link
Member Author

I didn't add a NEWS entry since this change doesn't impact users who respect the documentation: Py_DecodeLocale() and Py_EncodeLocale() must not be called before Python is preinitialized.

@vstinner vstinner merged commit 32b7bcf into python:main May 24, 2022
@vstinner vstinner deleted the preconfig branch May 24, 2022 22:09
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.

2 participants