diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2017-06-18 02:29:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-18 02:29:42 (GMT) |
commit | eb81795d7d3a8c898fa89a376d63fc3bbfb9a081 (patch) | |
tree | d991860d1d359c87dc4b609c421ad746fbc06d21 /Doc | |
parent | 6a98a04e21fc3209b2170c3930ce4488e89680e3 (diff) | |
download | cpython-eb81795d7d3a8c898fa89a376d63fc3bbfb9a081.zip cpython-eb81795d7d3a8c898fa89a376d63fc3bbfb9a081.tar.gz cpython-eb81795d7d3a8c898fa89a376d63fc3bbfb9a081.tar.bz2 |
bpo-30565: Add PYTHONCOERCECLOCALE=warn runtime flag (GH-2260)
- removes PY_WARN_ON_C_LOCALE build time flag
- locale coercion and compatibility warnings are now always compiled
in, but are off by default
- adds PYTHONCOERCECLOCALE=warn runtime option to aid in
debugging potentially locale related compatibility problems
Due to not-yet-resolved test failures on *BSD systems (including
Mac OS X), this also temporarily disables UTF-8 as a locale coercion
target, and skips testing the interpreter's behavior in the POSIX locale.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/using/cmdline.rst | 5 | ||||
-rw-r--r-- | Doc/whatsnew/3.7.rst | 19 |
2 files changed, 10 insertions, 14 deletions
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 920d5c0..5adad15 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -744,6 +744,11 @@ conflict. :data:`sys.stdin` and :data:`sys.stdout` to ``surrogateescape``. This behavior can be overridden using :envvar:`PYTHONIOENCODING` as usual. + For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause + Python to emit warning messages on ``stderr`` if either the locale coercion + activates, or else if a locale that *would* have triggered coercion is + still active when the Python runtime is initialized. + Availability: \*nix .. versionadded:: 3.7 diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index db11954..5f683eb 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -96,20 +96,11 @@ defined coercion target locales (currently ``C.UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler for ``stderr`` continues to be ``backslashreplace``, regardless of locale. -.. note:: - - In the current implementation, a warning message is printed directly to - ``stderr`` even for successful implicit locale coercion. This gives - redistributors and system integrators the opportunity to determine if they - should be making an environmental change to avoid the need for implicit - coercion at the Python interpreter level. - - However, it's not clear that this is going to be the best approach for - the final 3.7.0 release, and we may end up deciding to disable the warning - by default and provide some way of opting into it at runtime or build time. - - Concrete examples of use cases where it would be preferrable to disable the - warning by default can be noted on :issue:`30565`. +Locale coercion is silent by default, but to assist in debugging potentially +locale related integration problems, explicit warnings (emitted directly on +``stderr`` can be requested by setting ``PYTHONCOERCECLOCALE=warn``. This +setting will also cause the Python runtime to emit a warning if the legacy C +locale remains active when the core interpreter is initialized. .. seealso:: |