From: Walter Dörwald Date: Tue, 12 Jun 2007 16:51:31 +0000 (+0000) Subject: Mention name of left operand, if "foo in unicode_string" X-Git-Tag: v3.0a1~776 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26e0f51280af636e63001c6eee8c210a3db0d2c5;p=python Mention name of left operand, if "foo in unicode_string" fails. --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 39b746288b..bb4036aa7a 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -6001,8 +6001,9 @@ int PyUnicode_Contains(PyObject *container, /* Coerce the two arguments */ sub = PyUnicode_FromObject(element); if (!sub) { - PyErr_SetString(PyExc_TypeError, - "'in ' requires string as left operand"); + PyErr_Format(PyExc_TypeError, + "'in ' requires string as left operand, not %s", + element->ob_type->tp_name); return -1; }