PEP 538: Remove warnings from examples
PEP 538 is likely to be read by folks trying to understand the implications of locale coercion in Python 3.7. While I don't want to lose the history that we originally approved and implemented "warn by default" behaviour, the examples are easier to read if the warnings are omitted. I also added inline notes for the sections affected by the change in how the warning notifications are handled, since the implementation note at the top is easy to miss when following a direct link to a specific section.
This commit is contained in:
parent
177dcf1be1
commit
0a6522c339
24
pep-0538.txt
24
pep-0538.txt
|
@ -97,6 +97,9 @@ with a runtime ``PYTHONCOERCECLOCALE=warn`` environment variable setting
|
|||
that allows developers and system integrators to opt-in to receiving locale
|
||||
coercion and compatibility warnings, without emitting them by default.
|
||||
|
||||
The output examples in the PEP itself have also been updated to remove
|
||||
the warnings and make them easier to read.
|
||||
|
||||
|
||||
Background
|
||||
==========
|
||||
|
@ -352,10 +355,12 @@ proposed solution:
|
|||
PEP process or Python release announcements. However, to minimize the chance
|
||||
of introducing new problems for end users, we'll do this *without* using the
|
||||
warnings system, so even running with ``-Werror`` won't turn it into a runtime
|
||||
exception.
|
||||
exception. (Note: these warnings ended up being silenced by default. See the
|
||||
Implementation Note above for more details)
|
||||
* for Python 3.7, any changed defaults will offer some form of explicit "off"
|
||||
switch at build time, runtime, or both
|
||||
|
||||
|
||||
Minimizing the negative impact on systems currently correctly configured to
|
||||
use GB-18030 or another partially ASCII compatible universal encoding leads to
|
||||
the following design principle:
|
||||
|
@ -459,6 +464,9 @@ successfully configured::
|
|||
Python detected LC_CTYPE=C: LC_CTYPE coerced to C.UTF-8 (set another
|
||||
locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behaviour).
|
||||
|
||||
(Note: this warning ended up being silenced by default. See the
|
||||
Implementation Note above for more details)
|
||||
|
||||
As long as the current platform provides at least one of the candidate UTF-8
|
||||
based environments, this locale coercion will mean that the standard
|
||||
Python binary *and* locale-aware extensions should once again "just work"
|
||||
|
@ -508,6 +516,9 @@ configured locale is still the default ``C`` locale and
|
|||
C.utf8, or UTF-8 (if available) as alternative Unicode-compatible
|
||||
locales is recommended.
|
||||
|
||||
(Note: this warning ended up being silenced by default. See the
|
||||
Implementation Note above for more details)
|
||||
|
||||
In this case, no actual change will be made to the locale settings.
|
||||
|
||||
Instead, the warning informs both system and application integrators that
|
||||
|
@ -535,6 +546,10 @@ The locale warning behaviour would be controlled by the flag
|
|||
``--with[out]-c-locale-warning``, which would set the ``PY_WARN_ON_C_LOCALE``
|
||||
preprocessor definition.
|
||||
|
||||
(Note: this compile time warning option ended up being replaced by a runtime
|
||||
``PYTHONCOERCECLOCALE=warn`` option. See the Implementation Note above for
|
||||
more details)
|
||||
|
||||
On platforms which don't use the ``autotools`` based build system (i.e.
|
||||
Windows) these preprocessor variables would always be undefined.
|
||||
|
||||
|
@ -925,8 +940,6 @@ cover, as it avoids causing any problems in cases like the following::
|
|||
|
||||
$ LANG=C LC_MONETARY=ja_JP.utf8 ./python -c \
|
||||
"from locale import setlocale, LC_ALL, currency; setlocale(LC_ALL, ''); print(currency(1e6))"
|
||||
Python detected LC_CTYPE=C: LC_CTYPE & LANG coerced to C.UTF-8 (set another
|
||||
locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).
|
||||
¥1000000
|
||||
|
||||
|
||||
|
@ -966,9 +979,6 @@ from a PEP 538 enabled CPython build, where each line after the first is
|
|||
executed by doing "up-arrow, left-arrow x4, delete, enter"::
|
||||
|
||||
$ LANG=C ./python
|
||||
Python detected LC_CTYPE=C: LC_CTYPE & LANG coerced to C.UTF-8 (set
|
||||
another locale or PYTHONCOERCECLOCALE=0 to disable this locale
|
||||
coercion behavior).
|
||||
Python 3.7.0a0 (heads/pep538-coerce-c-locale:188e780, May 7 2017, 00:21:13)
|
||||
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
|
@ -1064,7 +1074,7 @@ Accordingly, this PEP originally proposed to disable locale coercion and
|
|||
warnings at build time for these platforms, on the assumption that it would
|
||||
be entirely redundant.
|
||||
|
||||
However, that assumpion turned out to be incorrect assumption, as subsequent
|
||||
However, that assumption turned out to be incorrect, as subsequent
|
||||
investigations showed that if you explicitly configure ``LANG=C`` on
|
||||
these platforms, extension modules like GNU readline will misbehave in much the
|
||||
same way as they do on other \*nix systems. [21_]
|
||||
|
|
Loading…
Reference in New Issue