cpython/Include/cpython
Victor Stinner d929f1838a
bpo-36443: Disable C locale coercion and UTF-8 Mode by default (GH-12589)
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.
2019-03-27 18:28:46 +01:00
..
abstract.h Fix typo in _PyObject_FastCallDict documentation (GH-12383) 2019-03-18 11:07:53 +01:00
coreconfig.h bpo-36443: Disable C locale coercion and UTF-8 Mode by default (GH-12589) 2019-03-27 18:28:46 +01:00
dictobject.h bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
interpreteridobject.h bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (gh-12359) 2019-03-15 16:35:46 -06:00
object.h bpo-35444: Unify and optimize the helper for getting a builtin object. (GH-11047) 2018-12-11 08:28:18 +02:00
objimpl.h bpo-35134: Create Include/cpython/ subdirectory (GH-10624) 2018-11-23 17:00:00 +01:00
pyerrors.h bpo-35724: Explicitly require the main interpreter for signal-handling. (GH-11530) 2019-02-23 15:40:43 -07:00
pylifecycle.h bpo-36444: Rework _Py_InitializeFromConfig() API (GH-12576) 2019-03-27 13:40:14 +01:00
pystate.h bpo-36444: Remove _PyMainInterpreterConfig (GH-12571) 2019-03-27 01:36:16 +01:00
tupleobject.h bpo-35134: Create Include/cpython/tupleobject.h (GH-10764) 2018-11-28 13:01:32 +01:00
unicodeobject.h bpo-36356: Release Unicode interned strings on Valgrind (#12431) 2019-03-19 14:20:29 +01:00