mirror of
https://github.com/python/cpython.git
synced 2025-10-13 18:33:34 +00:00
Fix for bug [ 561796 ] string.find causes lazy error
This commit is contained in:
parent
1e1542fcff
commit
4da6fd63bc
2 changed files with 4 additions and 3 deletions
|
@ -983,7 +983,8 @@ extern DL_IMPORT(int) PyUnicode_Tailmatch(
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Return the first position of substr in str[start:end] using the
|
/* 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(
|
extern DL_IMPORT(int) PyUnicode_Find(
|
||||||
PyObject *str, /* String */
|
PyObject *str, /* String */
|
||||||
|
|
|
@ -2887,11 +2887,11 @@ int PyUnicode_Find(PyObject *str,
|
||||||
|
|
||||||
str = PyUnicode_FromObject(str);
|
str = PyUnicode_FromObject(str);
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return -1;
|
return -2;
|
||||||
substr = PyUnicode_FromObject(substr);
|
substr = PyUnicode_FromObject(substr);
|
||||||
if (substr == NULL) {
|
if (substr == NULL) {
|
||||||
Py_DECREF(substr);
|
Py_DECREF(substr);
|
||||||
return -1;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = findstring((PyUnicodeObject *)str,
|
result = findstring((PyUnicodeObject *)str,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue