Jeremy Hylton:
better error message for unicode coercion failure
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7737057..f10b800 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -406,8 +406,10 @@
/* 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;
}