summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/stropmodule.c4
1 files changed, 2 insertions, 2 deletions
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 @@ 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)