[pypy-issue] Issue #1858: PyPy3: locale.format('%d', val, 1) -> UnicodeDecodeError (pypy/pypy)

Jens Diemer issues-reply at bitbucket.org
Thu Sep 4 13:48:55 CEST 2014


New issue 1858: PyPy3: locale.format('%d', val, 1) -> UnicodeDecodeError
https://bitbucket.org/pypy/pypy/issue/1858/pypy3-localeformat-d-val-1

Jens Diemer:

Test code:
-------------------------------------------------------------------------------
import locale

locale.setlocale(locale.LC_ALL, '')

val=1234567890.1234
print(val)
print(locale.format('%d', val, 1))
-------------------------------------------------------------------------------


Works in CPython 2.7 and 3.4 and with PyPy2 2.3.1 but not with PyPy3 2.3.1:



-------------------------------------------------------------------------------
Traceback (most recent call last):
  File "Bug_PyPy3_locale_format.py", line 8, in <module>
    print(locale.format('%d', val, 1))
  File "C:\pypy3-2.3.1-win32\lib-python\3\locale.py", line 195, in format
    return _format(percent, value, grouping, monetary, *additional)
  File "C:\pypy3-2.3.1-win32\lib-python\3\locale.py", line 216, in _format
    formatted, seps = _group(formatted, monetary=monetary)
  File "C:\pypy3-2.3.1-win32\lib-python\3\locale.py", line 140, in _group
    conv = localeconv()
  File "C:\pypy3-2.3.1-win32\lib-python\3\locale.py", line 111, in localeconv
    d = _localeconv()
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: invalid start byte
-------------------------------------------------------------------------------




More information about the pypy-issue mailing list