summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c2
-rw-r--r--Objects/unicodeobject.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 7a48627..9f41317 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -1536,7 +1536,7 @@ string_find_internal(PyStringObject *self, PyObject *args, int dir)
}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(subobj))
- return PyUnicode_Find((PyObject *)self, subobj, i, last, 1);
+ return PyUnicode_Find((PyObject *)self, subobj, i, last, dir);
#endif
else if (PyObject_AsCharBuffer(subobj, &sub, &n))
return -2;
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 4ac12a0..b264936 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2891,9 +2891,6 @@ int findstring(PyUnicodeObject *self,
if (start < 0)
start = 0;
- if (substring->length == 0)
- return start;
-
if (end > self->length)
end = self->length;
if (end < 0)
@@ -2901,6 +2898,9 @@ int findstring(PyUnicodeObject *self,
if (end < 0)
end = 0;
+ if (substring->length == 0)
+ return (direction > 0) ? start : end;
+
end -= substring->length;
if (direction < 0) {