You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
float format specifier throws on int, unlike in cpython. #838
If an int is passed to a float format specifier, IronPython treats the float specifier as an int specifier and throws, whereas cpython treats the int as a float.
Steps to Reproduce
>>> "{:.3f}".format(1)
Expected behavior:
Verified in cpython 2.7.1.7
>>> "{:.3f}".format(1)
'1.000'
>>>
Actual behavior: [What actually happened]
>>> "{:.3f}".format(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Precision not allowed in integer format specifier
>>>
Versions
IronPython 2.7.12 (2.7.12.1000)
[.NETFramework,Version=v4.5 on .NET Framework 4.8.9195.0 (64-bit)]
Activity
slozier commentedon Jan 13, 2024
I the fix is basically IronLanguages/ironpython3#1643 if anyone feels like backporting.
Port IronLanguages/ironpython3#1643 to ironpython2 for IronLanguages#838
Port IronLanguages/ironpython3#1643 to ironpython2 for #838. (#839)