This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients amaury.forgeotdarc, barry, r.david.murray
Date 2010-11-09.23:58:52
SpamBayes Score 1.4905643e-10
Marked as misclassified No
Message-id <1289347134.38.0.332414176414.issue10379@psf.upfronthosting.co.za>
In-reply-to
Content
Okay, so line 187 of locale.py has this test:

    if not match or len(match.group())!= len(percent):

the problematic part is the len test.  When format string is '%.0f KB' match.group() is '%.0f' but of course percent is the full string.

This seems like a bogus test, since clearly the given input is a valid format string.  I'm not sure what the intent of this test is.  The Python 2.6 test is:

    if percent[0] != '%':

which is perhaps too naive.

I guess I don't understand why this test is here.  Wouldn't it make more sense to either just let any TypeError from _format() to percolate up, or to catch that TypeError and transform it into the ValueError?  Why try to replicate the logic of str.__mod__()?
History
Date User Action Args
2010-11-09 23:58:54barrysetrecipients: + barry, amaury.forgeotdarc, r.david.murray
2010-11-09 23:58:54barrysetmessageid: <1289347134.38.0.332414176414.issue10379@psf.upfronthosting.co.za>
2010-11-09 23:58:52barrylinkissue10379 messages
2010-11-09 23:58:52barrycreate