Commit 566d8a64 authored by Marc-André Lemburg's avatar Marc-André Lemburg

Jeremy Hylton:

better error message for unicode coercion failure
parent 771d0675
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment