mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#17080: improve error message of float/complex when the wrong type is passed.
This commit is contained in:
parent
d0786a1a50
commit
a5b9599538
4 changed files with 11 additions and 6 deletions
|
@ -144,8 +144,9 @@ PyFloat_FromString(PyObject *v)
|
|||
}
|
||||
}
|
||||
else if (PyObject_AsCharBuffer(v, &s, &len)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"float() argument must be a string or a number");
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"float() argument must be a string or a number, not '%.200s'",
|
||||
Py_TYPE(v)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
last = s + len;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue