Marc-Andre Lemburg <mal@lemburg.com>:

Better error message for "1 in unicodestring". Submitted
by Andrew Kuchling.
This commit is contained in:
Marc-André Lemburg 2000-06-28 08:11:47 +00:00
parent e39607f27e
commit 7c014684c2
1 changed files with 4 additions and 1 deletions

View File

@ -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 <string>' requires character as left operand");
goto onError;
}
u = (PyUnicodeObject *)PyUnicode_FromObject(container);
if (u == NULL) {
Py_DECREF(v);