Commit 031c6315 authored by Guido van Rossum's avatar Guido van Rossum

Check for boundary errors in [r]find -- find("x", "", 2) should return -1.

parent c8d36284
......@@ -349,7 +349,7 @@ strop_find(self, args)
if (i < 0)
i = 0;
if (n == 0)
if (n == 0 && i <= last)
return PyInt_FromLong((long)i);
last -= n;
......@@ -394,7 +394,7 @@ strop_rfind(self, args)
if (i < 0)
i = 0;
if (n == 0)
if (n == 0 && i <= last)
return PyInt_FromLong((long)last);
for (j = last-n; j >= i; --j)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment