[New-bugs-announce] [issue7442] decimal.py: format failure with locale specifier

Stefan Krah report at bugs.python.org
Sat Dec 5 11:44:19 CET 2009


New submission from Stefan Krah <stefan-usenet at bytereef.org>:

Hi, the following works in 2.7 but not in 3.x:

>>> import locale
>>> from decimal import *
>>> locale.setlocale(locale.LC_NUMERIC, 'fi_FI')
'fi_FI'
>>> format(Decimal('1000'), 'n')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.2/decimal.py", line 3632, in __format__
    spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
  File "/usr/lib/python3.2/decimal.py", line 5628, in
_parse_format_specifier
    _localeconv = _locale.localeconv()
  File "/usr/lib/python3.2/locale.py", line 111, in localeconv
    d = _localeconv()
ValueError: Cannot convert byte to string

----------
messages: 95988
nosy: mark.dickinson, skrah
severity: normal
status: open
title: decimal.py: format failure with locale specifier
versions: Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7442>
_______________________________________


More information about the New-bugs-announce mailing list