This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients dmalcolm
Date 2011-04-11.22:46:56
SpamBayes Score 2.314815e-14
Marked as misclassified No
Message-id <1302562017.26.0.78208251188.issue11830@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-04-11 22:46:57dmalcolmsetrecipients: + dmalcolm
2011-04-11 22:46:57dmalcolmsetmessageid: <1302562017.26.0.78208251188.issue11830@psf.upfronthosting.co.za>
2011-04-11 22:46:56dmalcolmlinkissue11830 messages
2011-04-11 22:46:56dmalcolmcreate