[issue7442] decimal.py: format failure with locale specifier
Eric Smith
report at bugs.python.org
Fri Dec 18 01:36:00 CET 2009
Eric Smith <eric at trueblade.com> added the comment:
I can reproduce it on a Fedora (fc6) Linux box. It's not a decimal
problem, but a plain locale problem:
>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, 'fi_FI')
'fi_FI'
>>> locale.localeconv()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/python/py3k/Lib/locale.py", line 111, in localeconv
d = _localeconv()
ValueError: Cannot convert byte to string
>>>
Here's the contents of the struct lconv as returned by localeconv():
((gdb) p *l
$1 = {decimal_point = 0xb7b54020 ",", thousands_sep = 0xb7b54022 " ",
grouping = 0xb7b54024 "\003\003",
int_curr_symbol = 0x998858 "", currency_symbol = 0x998858 "",
mon_decimal_point = 0x998858 "", mon_thousands_sep = 0x998858 "",
mon_grouping = 0x998858 "", positive_sign = 0x998858 "", negative_sign
= 0x998858 "", int_frac_digits = 127 '\177',
frac_digits = 127 '\177', p_cs_precedes = 127 '\177', p_sep_by_space =
127 '\177', n_cs_precedes = 127 '\177',
n_sep_by_space = 127 '\177', p_sign_posn = 127 '\177', n_sign_posn =
127 '\177', int_p_cs_precedes = 127 '\177',
int_p_sep_by_space = 127 '\177', int_n_cs_precedes = 127 '\177',
int_n_sep_by_space = 127 '\177', int_p_sign_posn = 127 '\177',
int_n_sign_posn = 127 '\177'}
The problem is thousands_sep:
(gdb) p l->thousands_sep
$2 = 0xb7b54022 " "
(gdb) p (unsigned char)l->thousands_sep[0]
$3 = 160 ' '
----------
nosy: +eric.smith
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7442>
_______________________________________
More information about the Python-bugs-list
mailing list