);
/* Return the first position of substr in str[start:end] using the
- given search direction or -1 if not found. */
+ given search direction or -1 if not found. -2 is returned in case
+ an error occurred and an exception is set. */
extern DL_IMPORT(int) PyUnicode_Find(
PyObject *str, /* String */
str = PyUnicode_FromObject(str);
if (str == NULL)
- return -1;
+ return -2;
substr = PyUnicode_FromObject(substr);
if (substr == NULL) {
Py_DECREF(substr);
- return -1;
+ return -2;
}
result = findstring((PyUnicodeObject *)str,