]> granicus.if.org Git - python/commitdiff
Jeremy Hylton:
authorMarc-André Lemburg <mal@egenix.com>
Tue, 11 Jul 2000 09:47:04 +0000 (09:47 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Tue, 11 Jul 2000 09:47:04 +0000 (09:47 +0000)
better error message for unicode coercion failure

Objects/unicodeobject.c

index 7737057614dcf2c913edf21d88382f2a030ea4d9..f10b8002a812c867340d757f64c084fcb37d855d 100644 (file)
@@ -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;
     }