[IronPython] Formating Decimal numbers / re.match bug

Lukas Cenovsky cenovsky at bakalari.cz
Fri May 7 18:47:08 CEST 2010


Hi all,
formating Decimals does not work in IronPython:

IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
 >>> from decimal import Decimal
 >>> '{0:3.6f}'.format(Decimal('3.5'))
Traceback (most recent call last):
 File "<stdin>", line unknown, in <module>
 File "C:\src\python\decimal.py", line 3486, in __format__
 File "C:\src\python\decimal.py", line 5416, in _parse_format_specifier
ValueError: Invalid format specifier: 3.6f


It works in CPython:

Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> from decimal import Decimal
 >>> '{0:3.6f}'.format(Decimal('3.5'))
'3.500000'

It looks more like re bug because 
_parse_format_specifier_regex.match(format_spec) returns None in IronPython.

-- 
-- Lukáš


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100507/53d98d2f/attachment.html>


More information about the Ironpython-users mailing list