[IronPython] Formating Decimal numbers / re.match bug

Dino Viehland dinov at microsoft.com
Fri May 7 20:45:03 CEST 2010


Thanks for the report - I think I have a fix for this, we're simply not recognizing \A as meaning match at the start of input (which both Python and .NET recognize so it's just a matter of letting us pass it through).

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Friday, May 07, 2010 9:47 AM
To: users at lists.ironpython.com
Subject: [IronPython] Formating Decimal numbers / re.match bug

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/6dfb159d/attachment.html>


More information about the Ironpython-users mailing list