mirror of
https://github.com/python/cpython.git
synced 2026-04-23 12:21:01 +00:00
[3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion off by default (GH-9379)
* bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371) _PyCoreConfig: * Rename coerce_c_locale to _coerce_c_locale * Rename coerce_c_locale_warn to _coerce_c_locale_warn These fields are now private (name prefixed by "_"). (cherry picked from commit188ebfa475) * bpo-34589: C locale coercion off by default (GH-9073) Py_Initialize() and Py_Main() cannot enable the C locale coercion (PEP 538) anymore: it is always disabled. It can now only be enabled by the Python program ("python3). test_embed: get_filesystem_encoding() doesn't have to set PYTHONUTF8 nor PYTHONCOERCECLOCALE, these variables are already set in the parent. (cherry picked from commit7a0791b699) * bpo-34589: Add -X coerce_c_locale command line option (GH-9378) Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538). (cherry picked from commitdbdee0073c)
This commit is contained in:
parent
512d710109
commit
144f1e2c6f
15 changed files with 224 additions and 67 deletions
|
|
@ -400,7 +400,7 @@ static const char *_C_LOCALE_WARNING =
|
|||
static void
|
||||
_emit_stderr_warning_for_legacy_locale(const _PyCoreConfig *core_config)
|
||||
{
|
||||
if (core_config->coerce_c_locale_warn) {
|
||||
if (core_config->_coerce_c_locale_warn) {
|
||||
if (_Py_LegacyLocaleDetected()) {
|
||||
fprintf(stderr, "%s", _C_LOCALE_WARNING);
|
||||
}
|
||||
|
|
@ -462,7 +462,7 @@ _coerce_default_locale_settings(const _PyCoreConfig *config, const _LocaleCoerci
|
|||
"Error setting LC_CTYPE, skipping C locale coercion\n");
|
||||
return;
|
||||
}
|
||||
if (config->coerce_c_locale_warn) {
|
||||
if (config->_coerce_c_locale_warn) {
|
||||
fprintf(stderr, C_LOCALE_COERCION_WARNING, newloc);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue