commit | 031c6315e23d41e253c914eceffd30afe8a0f2cd | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Tue Mar 24 04:19:22 1998 +0000 |
committer | Guido van Rossum <guido@python.org> | Tue Mar 24 04:19:22 1998 +0000 |
tree | 2b78c30a95d93e269c5da05236d372592b586fbb | |
parent | c8d36284f3456af9991df6f225f6dc1af742aa3a [diff] |
Check for boundary errors in [r]find -- find("x", "", 2) should return -1.
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index 1821db8..e9e9039 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c
@@ -349,7 +349,7 @@ if (i < 0) i = 0; - if (n == 0) + if (n == 0 && i <= last) return PyInt_FromLong((long)i); last -= n; @@ -394,7 +394,7 @@ 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)