diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 3157cd89c51..1aa03f74c02 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2988,8 +2988,11 @@ int PyUnicode_Contains(PyObject *container, /* Coerce the two arguments */ v = (PyUnicodeObject *)PyUnicode_FromObject(element); - if (v == NULL) + if (v == NULL) { + PyErr_SetString(PyExc_TypeError, + "'in ' requires character as left operand"); goto onError; + } u = (PyUnicodeObject *)PyUnicode_FromObject(container); if (u == NULL) { Py_DECREF(v);