]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix for bug [ 561796 ] string.find causes lazy error
authorMarc-André Lemburg <mal@egenix.com>
Wed, 29 May 2002 11:33:13 +0000 (11:33 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Wed, 29 May 2002 11:33:13 +0000 (11:33 +0000)
Include/unicodeobject.h
Objects/unicodeobject.c

index 103649deb3502d6019f56ed09b56854cd116b5ec..d0a2885ccfe64bbd47606e670529eb60dcd0b1fc 100644 (file)
@@ -983,7 +983,8 @@ extern DL_IMPORT(int) PyUnicode_Tailmatch(
     );
 
 /* 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 */ 
index 0ac4941de160429d096021dfe78b9febbc9229a2..e24453d17d78b05efcb2ce94d7e5263796fdc634 100644 (file)
@@ -2887,11 +2887,11 @@ int PyUnicode_Find(PyObject *str,
     
     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,