= Proposed Self Contained Change: Python 3 C.UTF-8 locale =
* Charalampos Stratakis <cstratak AT redhat DOT com>
* Nick Coghlan <ncoghlan AT redhat DOT com>
The standalone Python 3.6 binary will automatically attempt to coerce
the C locale to C.UTF-8, unless the new PYTHONALLOWLOCALE environment
variable is set to 1.
== Detailed Description ==
When run under the C locale, Python 3 doesn't work properly on systems
where UTF-8 is the correct encoding for interacting with the rest of
the system. This proposed change for Python 3 packaged in Fedora
assumes the current locale is misconfigured when it detects that
"LC_TYPE" refers to the "C" locale, and in that case, prints a
warnings to stderr and forces the use of the C.UTF-8 locale instead.
To avoid unintended side effects, this change takes effect *solely*
when Python 3 is invoked by the user—nothing changes in cases where
CPython is used as a dynamically linked library. Also, an "escape
hatch" environment variable is provided to revert to the old behavior.
The effects of the problem for a popular CLI construction library are
explained on Armin Ronacher's blog:
The problem is described in detail in PEP (Python Enhancement
Proposal) 538: https://www.python.org/dev/peps/pep-0538/
The PEP has no strong opposition upstream, but acceptance is held back
by considerations for other systems (e.g. those that do not have a
C.UTF-8 locale). These considerations do not apply for Fedora. We are
commited to follow upstream conversation and recommendations around
PEP 538. Also, we hope that testing this in Fedora will help upstream
find remaining distro integration issues.
The current version of the PEP specifically encourages backporting to
Python 3.6.0: https://www.python.org/dev/peps/pep-0538/#backporting-to-python-3-6-0
Check the Change Page for an example of the behaviour:
== Scope ==
* Proposal owners:
A patch will be backported to Fedora's Python 3.6 from the upstream
PEP 538 which targets Python 3.7. The patch that will be backported is
explicitly targeting Fedora, as the upstream equivalent one will have
to be compatible with Windows, macOS, Solaris etc. The Fedora specific
patch is provided by Nick Coghlan, a Python core developer.
* Release engineering:
No impact with release engineering
Platform & Fedora Program Manager
Red Hat Czech s.r.o., Purkynova 99/71, 612 45 Brno, Czech Republic