diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/complexobject.c | 10 | ||||
-rw-r--r-- | Objects/floatobject.c | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c index 64e7b44..60a388f 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -773,8 +773,9 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v) goto error; } else if (PyObject_AsCharBuffer(v, &s, &len)) { - PyErr_SetString(PyExc_TypeError, - "complex() argument must be a string or a number"); + PyErr_Format(PyExc_TypeError, + "complex() argument must be a string or a number, not '%.200s'", + Py_TYPE(v)->tp_name); return NULL; } @@ -953,8 +954,9 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds) nbi = i->ob_type->tp_as_number; if (nbr == NULL || nbr->nb_float == NULL || ((i != NULL) && (nbi == NULL || nbi->nb_float == NULL))) { - PyErr_SetString(PyExc_TypeError, - "complex() argument must be a string or a number"); + PyErr_Format(PyExc_TypeError, + "complex() argument must be a string or a number, not '%.200s'", + Py_TYPE(r)->tp_name); if (own_r) { Py_DECREF(r); } diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 9771063..abea975 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; |