diff options
author | Marc-André Lemburg <mal@egenix.com> | 2000-07-11 09:47:04 +0000 |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2000-07-11 09:47:04 +0000 |
commit | 566d8a64eb4f51510dd17df8a478e7c0c10ec498 (patch) | |
tree | 2f76d2eb045fade825dd9d3531606e4a99aab3f3 /Objects | |
parent | 771d0675b6fc08f2744c71cc66664d4ea4b22271 (diff) | |
download | cpython-git-566d8a64eb4f51510dd17df8a478e7c0c10ec498.tar.gz |
Jeremy Hylton:
better error message for unicode coercion failure
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7737057614..f10b8002a8 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -406,8 +406,10 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj, /* Overwrite the error message with something more useful in case of a TypeError. */ if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_SetString(PyExc_TypeError, - "coercing to Unicode: need string or buffer"); + PyErr_Format(PyExc_TypeError, + "coercing to Unicode: need string or buffer, " + "%.80s found", + obj->ob_type->tp_name); goto onError; } |