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.
Created on 2011年07月01日 21:05 by rndblnch, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| PyUnicode_Format_TypeError_message.patch | rndblnch, 2011年07月01日 21:05 | patch fixing the bug | ||
| PyUnicode_Format_TypeError_message.2.7.patch | rndblnch, 2011年07月04日 09:30 | patch backported to 2.7 | review | |
| Messages (3) | |||
|---|---|---|---|
| msg139607 - (view) | Author: Renaud Blanch (rndblnch) | Date: 2011年07月01日 21:05 | |
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. |
|||
| msg139734 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年07月04日 04:05 | |
New changeset 97707459bb5a by Senthil Kumaran in branch '3.2': Fix closes issue12471 - wrong TypeError message when '%i' format spec was used. http://hg.python.org/cpython/rev/97707459bb5a |
|||
| msg139744 - (view) | Author: Renaud Blanch (rndblnch) | Date: 2011年07月04日 09:30 | |
that was quick! just a question: is it worth backporting the fix to 2.7? if this helps, here is a backport for the patch commited to 3.2 <http://hg.python.org/cpython/rev/97707459bb5a> |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:19 | admin | set | github: 56680 |
| 2011年07月04日 09:30:49 | rndblnch | set | files:
+ PyUnicode_Format_TypeError_message.2.7.patch messages: + msg139744 |
| 2011年07月04日 04:05:37 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg139734 resolution: fixed stage: resolved |
| 2011年07月01日 21:05:18 | rndblnch | create | |