From: Marc-André Lemburg Date: Tue, 11 Jul 2000 09:47:04 +0000 (+0000) Subject: Jeremy Hylton: X-Git-Tag: v2.0b1~902 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=566d8a64eb4f51510dd17df8a478e7c0c10ec498;p=thirdparty%2FPython%2Fcpython.git Jeremy Hylton: better error message for unicode coercion failure --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7737057614dc..f10b8002a812 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; }