Author eric.smith
Recipients Gavin.Andresen, davide.rizzo, eric.smith, ezio.melotti
Date 2011-07-19.10:17:30
SpamBayes Score 1.1057e-06
Marked as misclassified No
Message-id <1311070651.67.0.617298207572.issue12546@psf.upfronthosting.co.za>
In-reply-to
Content
I finally got around to reviewing the patch. A couple of comments:

1. There should be some tests for str.__format__, not just str.format. This is really a bug with str.__format__, after all. I can add those.

2. The bigger issue is that the other built in formatters have this same problem.

>>> format(3, '\x00<6')
'3     '
>>> format(3., '\x00<6')
'3.0   '
>>> format('3', '\x00<6')
'3\x00\x00\x00\x00\x00'
>>> format(3+1j, '\x00<6')
'(3+1j)'
[38654 refs]
>>> format(3+1j, '\x00<10')
'(3+1j)    '

I think the fix is basically the same as str.__format__ (but in format_int_or_long_internal, format_float_internal, and format_complex_internal). I tried that and it worked, but I haven't had time to write tests for them. If you (Davide) can do that, great. Otherwise I'll try and grab some time this week.

Changing the subject to match the wider scope of the problem.
History
Date User Action Args
2011-07-19 10:17:31eric.smithsetrecipients: + eric.smith, ezio.melotti, davide.rizzo, Gavin.Andresen
2011-07-19 10:17:31eric.smithsetmessageid: <1311070651.67.0.617298207572.issue12546@psf.upfronthosting.co.za>
2011-07-19 10:17:31eric.smithlinkissue12546 messages
2011-07-19 10:17:30eric.smithcreate