New submission from Dave Malcolm <dmalc...@redhat.com>: 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 ---------- components: Library (Lib) files: decimal.py.patch keywords: patch messages: 133550 nosy: dmalcolm priority: normal severity: normal status: open title: "import decimal" fails in Turkish locale versions: Python 2.7 Added file: http://bugs.python.org/file21622/decimal.py.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11830> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com