From 4da6fd63bc431468e9622341ac410c55a54c7b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lemburg?= Date: Wed, 29 May 2002 11:33:13 +0000 Subject: [PATCH] Fix for bug [ 561796 ] string.find causes lazy error --- Include/unicodeobject.h | 3 ++- Objects/unicodeobject.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 103649deb35..d0a2885ccfe 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -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 */ diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 0ac4941de16..e24453d17d7 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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,