Bug 1391280 - Exception raised by python3 when using en_GB locale
Summary: Exception raised by python3 when using en_GB locale
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: 28
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Victor Stinner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-02 22:45 UTC by Guillaume Pasquet
Modified: 2019-01-19 01:54 UTC (History)
8 users (show)

Fixed In Version: python3-3.6.8-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-19 01:54:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Python 28604 0 None None None 2016-11-04 09:22:43 UTC

Description Guillaume Pasquet 2016-11-02 22:45:28 UTC
Description of problem:
After switching the monetary locale to en_GB, python then raises an exception when calling locale.localeconv()

Version-Release number of selected component (if applicable):
3.5.2-4.fc25

How reproducible:
Every time

Steps to Reproduce:
1. Write a python3 script or open the interactive interpreter with "python3"
2. Enter the following
import locale
locale.setlocale(locale.LC_MONETARY, 'en_GB')
locale.localeconv()
3. Observe that python raises an encoding exception

Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.5/locale.py", line 110, in localeconv
    d = _localeconv()
UnicodeDecodeError: 'locale' codec can't decode byte 0xa3 in position 0: Invalid or incomplete multibyte or wide character

Expected results:
A dictionary of locale data similar to (for en_US):
{'mon_thousands_sep': ',', 'currency_symbol': '$', 'negative_sign': '-', 'p_sep_by_space': 0, 'frac_digits': 2, 'int_frac_digits': 2, 'decimal_point': '.', 'mon_decimal_point': '.', 'positive_sign': '', 'p_cs_precedes': 1, 'p_sign_posn': 1, 'mon_grouping': [3, 3, 0], 'n_cs_precedes': 1, 'n_sign_posn': 1, 'grouping': [3, 3, 0], 'thousands_sep': ',', 'int_curr_symbol': 'USD ', 'n_sep_by_space': 0}

Comment 1 Miro Hrončok 2016-11-03 00:46:58 UTC
Happens also on Fedora 23 and Python 3.4.

Comment 2 Guillaume Pasquet 2016-11-03 09:09:47 UTC
Note that I managed to reproduce this on Linux Mint 18, so I suspect it's a bug with python itself rather than Fedora's packaging.

Comment 3 Charalampos Stratakis 2016-11-03 09:50:50 UTC
I compiled python from source and reproduced the issue as well from the latest 3.6 beta branch, so I believe this should be reported upstream.

Comment 4 Guillaume Pasquet 2016-11-03 10:02:20 UTC
(In reply to Charalampos Stratakis from comment #3)
> I compiled python from source and reproduced the issue as well from the
> latest 3.6 beta branch, so I believe this should be reported upstream.

Do you mean that you will report it upstream, or should I do this?

Comment 5 Charalampos Stratakis 2016-11-03 13:12:46 UTC
(In reply to Guillaume Pasquet from comment #4)
> (In reply to Charalampos Stratakis from comment #3)
> > I compiled python from source and reproduced the issue as well from the
> > latest 3.6 beta branch, so I believe this should be reported upstream.
> 
> Do you mean that you will report it upstream, or should I do this?

Please do it if possible at http://bugs.python.org/ and provide the reproducer there. I did a quick search and didn't find something similar, but it might be system related as well.

Comment 6 Guillaume Pasquet 2016-11-03 21:27:31 UTC
(In reply to Charalampos Stratakis from comment #5)
> (In reply to Guillaume Pasquet from comment #4)
> > (In reply to Charalampos Stratakis from comment #3)
> > > I compiled python from source and reproduced the issue as well from the
> > > latest 3.6 beta branch, so I believe this should be reported upstream.
> > 
> > Do you mean that you will report it upstream, or should I do this?
> 
> Please do it if possible at http://bugs.python.org/ and provide the
> reproducer there. I did a quick search and didn't find something similar,
> but it might be system related as well.

I have reported the issue on Python's bug tracker:

http://bugs.python.org/issue28604

Comment 7 Fedora End Of Life 2017-11-16 19:49:34 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 8 Charalampos Stratakis 2017-11-20 17:19:06 UTC
Still valid.

Possible fix upstream waiting to be merged: https://github.com/python/cpython/pull/4174

Will need to test a build with the fix to verify it.

Comment 9 Miro Hrončok 2018-02-15 14:54:37 UTC
The PR was merged. Probably we should backport it.

Comment 10 Fedora End Of Life 2018-02-20 15:33:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 11 Charalampos Stratakis 2018-02-22 16:14:11 UTC
(In reply to Miro Hrončok from comment #9)
> The PR was merged. Probably we should backport it.

Already done [0] but it doesn't fix that particular issue.

[0] https://src.fedoraproject.org/rpms/python3/c/40bb48b58479cf1b301b2e5a073d9d07f9c32420?branch=master

Comment 12 Victor Stinner 2018-03-01 15:14:14 UTC
This issue seems similar but different than fixed https://bugs.python.org/issue31900

Here the LC_MONETARY locale is different than the LC_CTYPE locale, whereas the fixed bug was when the LC_NUMERIC locale is different than the LC_CTYPE locale. It seems like the bug should be extended for the LC_MONETARY locale. You should open a different issue upstream if you want to see this specific corner case handled properly.

Note: The workaround is to use the same locale for LC_MONETARY and LC_CTYPE.

Comment 13 Petr Viktorin (pviktori) 2019-01-07 13:23:22 UTC
This is fixed in 3.7.2 and 3.6.8, so it should be fixed with the next releases.

Comment 14 Fedora Update System 2019-01-07 13:24:04 UTC
python3-3.6.8-1.fc28 python3-docs-3.6.8-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-541a12b809

Comment 15 Fedora Update System 2019-01-19 01:54:35 UTC
python3-3.6.8-1.fc28, python3-docs-3.6.8-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.