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 rndblnch
Recipients rndblnch
Date 2011-07-01.21:05:17
SpamBayes Score 7.633886e-09
Marked as misclassified No
Message-id <1309554318.72.0.913120070593.issue12471@psf.upfronthosting.co.za>
In-reply-to
Content
The TypeError message is erroneous when attempting to format a non number object with a '%i' string (notice the '%d' in the error message):

    >>> '%i' % 's'
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: %d format: a number is required, not str

This is because PyUnicode_Format aliases i to d for the formatting handling, but this has the side effect of performing the substitution in the error message too.

The attached patch (against 3.3, but this behaviour has been there since 2.6) suppress the side effect and corrects the error message.
History
Date User Action Args
2011-07-01 21:05:18rndblnchsetrecipients: + rndblnch
2011-07-01 21:05:18rndblnchsetmessageid: <1309554318.72.0.913120070593.issue12471@psf.upfronthosting.co.za>
2011-07-01 21:05:18rndblnchlinkissue12471 messages
2011-07-01 21:05:18rndblnchcreate