Message12078

Author jeff.allen
Recipients _peter_holloway, jeff.allen
Date 2018-08-10.21:10:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533935444.22.0.56676864532.issue2691@psf.upfronthosting.co.za>
In-reply-to
Content
This isn't as obviously wrong as it looks at first.

I would say we have followed the convention that no type means "d":
>>> True.__format__("10")
'         1'
>>> True.__format__("<")
'1'
>>> True.__format__("d")
'1'

But we missed the convention that an empty format string ("") produces the same result as if you had called str() on the value.
>>> True.__format__("")
'True'

See: https://docs.python.org/2/library/string.html#format-specification-mini-language

I'm surprised that nothing in the regression tests has caught this, but there just isn't one in the Python suite. So a solution should start with a failing test in (I think) test_format_jy checking this for True and False, and maybe a few where it is 1, 0 for good measure.
History
Date User Action Args
2018-08-10 21:10:44jeff.allensetmessageid: <1533935444.22.0.56676864532.issue2691@psf.upfronthosting.co.za>
2018-08-10 21:10:44jeff.allensetrecipients: + jeff.allen, _peter_holloway
2018-08-10 21:10:44jeff.allenlinkissue2691 messages
2018-08-10 21:10:43jeff.allencreate