mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
Fix closes issue12471 - wrong TypeError message when '%i' format spec was used.
This commit is contained in:
parent
a55007a620
commit
9ebe08d2f6
2 changed files with 2 additions and 3 deletions
|
@ -9689,8 +9689,6 @@ PyObject *PyUnicode_Format(PyObject *format,
|
|||
case 'o':
|
||||
case 'x':
|
||||
case 'X':
|
||||
if (c == 'i')
|
||||
c = 'd';
|
||||
isnumok = 0;
|
||||
if (PyNumber_Check(v)) {
|
||||
PyObject *iobj=NULL;
|
||||
|
@ -9705,7 +9703,7 @@ PyObject *PyUnicode_Format(PyObject *format,
|
|||
if (iobj!=NULL) {
|
||||
if (PyLong_Check(iobj)) {
|
||||
isnumok = 1;
|
||||
temp = formatlong(iobj, flags, prec, c);
|
||||
temp = formatlong(iobj, flags, prec, (c == 'i'? 'd': c));
|
||||
Py_DECREF(iobj);
|
||||
if (!temp)
|
||||
goto onError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue