Kaydet (Commit) ebafbb70 authored tarafından Eric Smith's avatar Eric Smith

Fixed issue 5782: formatting with commas didn't work if no specifier type code was given.

üst 5533ff6a
...@@ -405,6 +405,9 @@ class TypesTests(unittest.TestCase): ...@@ -405,6 +405,9 @@ class TypesTests(unittest.TestCase):
test(123456, "#012X", '0X000001E240') test(123456, "#012X", '0X000001E240')
test(-123456, "#012X", '-0X00001E240') test(-123456, "#012X", '-0X00001E240')
# issue 5782, commas with no specifier type
test(1234, '010,', '00,001,234')
# make sure these are errors # make sure these are errors
# precision disallowed # precision disallowed
...@@ -632,6 +635,9 @@ class TypesTests(unittest.TestCase): ...@@ -632,6 +635,9 @@ class TypesTests(unittest.TestCase):
test(-1234.12341234, '013f', '-01234.123412') test(-1234.12341234, '013f', '-01234.123412')
test(-123456.12341234, '011.2f', '-0123456.12') test(-123456.12341234, '011.2f', '-0123456.12')
# issue 5782, commas with no specifier type
test(1.2, '010,.2', '0,000,001.2')
# 0 padding with commas # 0 padding with commas
test(1234., '011,f', '1,234.000000') test(1234., '011,f', '1,234.000000')
test(1234., '012,f', '1,234.000000') test(1234., '012,f', '1,234.000000')
......
...@@ -248,6 +248,7 @@ parse_internal_render_format_spec(STRINGLIB_CHAR *format_spec, ...@@ -248,6 +248,7 @@ parse_internal_render_format_spec(STRINGLIB_CHAR *format_spec,
case 'G': case 'G':
case '%': case '%':
case 'F': case 'F':
case '\0':
/* These are allowed. See PEP 378.*/ /* These are allowed. See PEP 378.*/
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment