New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"import decimal" fails in Turkish locale #56039
Comments
For Python 2 (here with 2.7.1): 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 This would work since upper() for a unicode instance is locale-independent as 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: |
New changeset b4b1f557d563 by Raymond Hettinger in branch '2.7': |
Shouldn't this be forward ported to 3.3? Even though there is no bug in 3.x, code using an explicit dict is cleaner and more robust than the current code that relies on introspection to find methods that start with '_round_'. |
New changeset f4adc2926bf5 by Raymond Hettinger in branch '2.7': |
+0 on forward porting |
New changeset f5d5f3f4c081 by Alexander Belopolsky in branch '3.2': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: