From Fedora Project Wiki
Line 154: Line 154:


<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "Revert the shipped configuration".  Or it might not (e.g. rebuilding a number of dependent packages).  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "Revert the shipped configuration".  Or it might not (e.g. rebuilding a number of dependent packages).  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
* Contingency mechanism: (What to do?  Who will do it?) N/A (not a System Wide Change)  <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Contingency mechanism: Remove the patch from Python 3.6 <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- When is the last time the contingency mechanism can be put in place?  This will typically be the beta freeze. -->
<!-- When is the last time the contingency mechanism can be put in place?  This will typically be the beta freeze. -->
* Contingency deadline: N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Contingency deadline: If users experience any issues this change can be reverted at any time <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
<!-- Does finishing this feature block the release, or can we ship with the feature in incomplete state? -->
* Blocks release? N/A (not a System Wide Change), Yes/No <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks release? No <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Blocks product? product <!-- Applicable for Changes that blocks specific product release/Fedora.next -->
* Blocks product? No <!-- Applicable for Changes that blocks specific product release/Fedora.next -->


== Documentation ==
== Documentation ==

Revision as of 10:44, 14 February 2017


Change Proposal Name

Summary

Force C.UTF-8 when Python 3 is run under the C locale

Owner

Current status

  • Targeted release: Fedora 26
  • Last updated: 2017-02-14
  • Tracker bug: <will be assigned by the Wrangler>

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 is described in detail by Armin Ronacher in the click documentation: http://click.pocoo.org/5/python3/#python-3-surrogate-handling


This proposed change for the system Python 3 that assumes the current process is misconfigured when it detects that "LC_CTYPE" 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, it *solely* changes the actual python3.6 command line utility - nothing changes for cases where CPython is used as a dynamically linked library.

Behaviour with the patch:

$ LANG=C python -c 'import click; cli = click.command()(lambda:None); cli()'

Python detected LC_CTYPE=C. Setting LC_ALL & LANG to C.UTF-8.

Behaviour without the patch:

$ LANG=C /usr/bin/python3 -c 'import click; cli = click.command()(lambda:None); cli()'

Traceback (most recent call last):

 File "<string>", line 1, in <module>
 File "/home/ncoghlan/.local/lib/python3.5/site-packages/click/core.py", line 716, in __call__
   return self.main(*args, **kwargs)
 File "/home/ncoghlan/.local/lib/python3.5/site-packages/click/core.py", line 675, in main
   _verify_python3_env()
 File "/home/ncoghlan/.local/lib/python3.5/site-packages/click/_unicodefun.py", line 119, in _verify_python3_env
   'mitigation steps.' + extra)

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Either run this under Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables:

export LC_ALL=C.UTF-8 export LANG=C.UTF-8

Benefit to Fedora

Scope

  • Proposal owners:

A patch will be backported to Fedora's Python 3.6 from the upstream PEP 538 which target Python 3.7

  • Release engineering: No impact with release engineering

Upgrade/compatibility impact

N/A (not a System Wide Change)

How To Test

N/A (not a System Wide Change)

User Experience

N/A (not a System Wide Change)

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: Remove the patch from Python 3.6
  • Contingency deadline: If users experience any issues this change can be reverted at any time
  • Blocks release? No
  • Blocks product? No

Documentation

N/A (not a System Wide Change)

Release Notes