[issue7442] decimal.py: format failure with locale specifier

2009-12-18 Thread Stefan Krah
Stefan Krah added the comment: Yes, it's a problem in _localemodule.c. This situation always occurs when LC_NUMERIC is something like ISO8859-15, LC_CTYPE is UTF-8 AND the decimal point or separator are in the range 128-255. Then mbstowcs tries to decode the character according to LC_CTYPE and f

[issue7442] decimal.py: format failure with locale specifier

2009-12-17 Thread Eric Smith
Eric Smith 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 "", line 1, in Fi

[issue7442] decimal.py: format failure with locale specifier

2009-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: What are the multibyte strings that mbstowcs is failing to convert? On my machine, the separators come out as plain ASCII '.' (for thousands) and ',' (for the decimal point). -- ___ Python tracker

[issue7442] decimal.py: format failure with locale specifier

2009-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: I'm failing to reproduce this (with py3k) on OS X: Python 3.2a0 (py3k:76866:76867, Dec 17 2009, 09:19:26) [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> from de

[issue7442] decimal.py: format failure with locale specifier

2009-12-05 Thread Stefan Krah
Stefan Krah added the comment: This fails in _localemodule.c: str2uni(). mbstowcs(NULL, s, 0) is LC_CTYPE sensitive, but LC_CTYPE is UTF-8 in my terminal. If I set LC_CTYPE and LC_NUMERIC together, things work. This raises the question: If LC_CTYPE and LC_NUMERIC differ (and since they are sep

[issue7442] decimal.py: format failure with locale specifier

2009-12-05 Thread Stefan Krah
New submission from Stefan Krah : 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 "", line 1, in File "/usr/lib/python