Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Mar 27, 2019

bpo-36443, bpo-36202: Since Python 3.7.0, calling Py_DecodeLocale()
before Py_Initialize() produces mojibake if the LC_CTYPE locale is
coerced and/or if the UTF-8 Mode is enabled by the user
configuration. This change fix the issue by disabling LC_CTYPE
coercion and UTF-8 Mode by default. They must now be enabled
explicitly (opt-in) using the new _Py_PreInitialize() API with
_PyPreConfig.

When embedding Python, set coerce_c_locale and utf8_mode attributes
of _PyPreConfig to -1 to enable automatically these parameters
depending on the LC_CTYPE locale, environment variables and command
line arguments

Alternative: Setting Py_UTF8Mode to 1 always explicitly enables the
UTF-8 Mode.

Changes:

  • _PyPreConfig_INIT now sets coerce_c_locale and utf8_mode to 0 by
    default.
  • _Py_InitializeFromArgs() and _Py_InitializeFromWideArgs() can now
    be called with config=NULL.

https://bugs.python.org/issue36443

bpo-36443, bpo-36202: Since Python 3.7.0, calling Py_DecodeLocale()
before Py_Initialize() produces mojibake if the LC_CTYPE locale is
coerced and/or if the UTF-8 Mode is enabled by the user
configuration. This change fix the issue by disabling LC_CTYPE
coercion and UTF-8 Mode by default. They must now be enabled
explicitly (opt-in) using the new _Py_PreInitialize() API with
_PyPreConfig.

When embedding Python, set coerce_c_locale and utf8_mode attributes
of _PyPreConfig to -1 to enable automatically these parameters
depending on the LC_CTYPE locale, environment variables and command
line arguments

Alternative: Setting Py_UTF8Mode to 1 always explicitly enables the
UTF-8 Mode.

Changes:

* _PyPreConfig_INIT now sets coerce_c_locale and utf8_mode to 0 by
  default.
* _Py_InitializeFromArgs() and _Py_InitializeFromWideArgs() can now
  be called with config=NULL.
@vstinner
Copy link
Member Author

New commit to fix a typo in the NEWS entry.

@vstinner vstinner closed this Mar 27, 2019
@vstinner vstinner reopened this Mar 27, 2019
@vstinner
Copy link
Member Author

The doc job of Travis CI didn't run in 1 hour. I closed/reopened the PR to start a new fresh Travis CI job.

@vstinner
Copy link
Member Author

Ah, Travis CI has some issues: https://www.traviscistatus.com/incidents/my5wm56npf7q

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants