diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-11-07 19:18:34 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-11-07 19:18:34 +0200 |
commit | a5b9599538083468cffee3c052e15dd541c4bbd5 (patch) | |
tree | 62ec19c7e876881fccd49e0eada11c08ea461806 /Objects/floatobject.c | |
parent | d0786a1a5036c06770f1c958323387fd682e789e (diff) | |
download | cpython-git-a5b9599538083468cffee3c052e15dd541c4bbd5.tar.gz |
#17080: improve error message of float/complex when the wrong type is passed.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 9771063644..abea975c59 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -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; |