Message133550
For Python 2 (here with 2.7.1):
$ python -c 'import locale; locale.setlocale(locale.LC_ALL, "tr_TR.UTF-8"); import decimal'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib64/python2.7/decimal.py", line 3715, in <module>
val = globals()[globalname]
KeyError: 'ROUND_CEiLiNG'
The issue is that 'round_ceiling'.upper() is 'ROUND_CEiLiNG' in the Turkish locale, rather than 'ROUND_CEILING', as one might expect.
A workaround for this may be to convert the str instances to unicode
first, then call upper on them, then convert back to str.
This would work since upper() for a unicode instance is locale-independent as
per issue 1528802.
(though there seems to have been some debate there).
Patch attached, though it doesn't yet contain a test case.
Only affects Python 2; with Python 3, the symbols are already stored as unicode internally.
Reported downstream as:
https://bugzilla.redhat.com/show_bug.cgi?id=694928
which has links to various other reports on this |
|
Date |
User |
Action |
Args |
2011-04-11 22:46:57 | dmalcolm | set | recipients:
+ dmalcolm |
2011-04-11 22:46:57 | dmalcolm | set | messageid: <1302562017.26.0.78208251188.issue11830@psf.upfronthosting.co.za> |
2011-04-11 22:46:56 | dmalcolm | link | issue11830 messages |
2011-04-11 22:46:56 | dmalcolm | create | |
|