Commit 4ccda15c authored by Guido van Rossum's avatar Guido van Rossum

strop_replace(): balk if the pattern string is empty.

parent ed33a3f4
......@@ -1091,6 +1091,10 @@ strop_replace(self, args)
&str, &len, &pat, &pat_len, &sub, &sub_len,
&count))
return NULL;
if (pat_len <= 0) {
PyErr_SetString(PyExc_ValueError, "empty pattern string");
return NULL;
}
new_s = mymemreplace(str,len,pat,pat_len,sub,sub_len,count,&out_len);
if (new_s == NULL) {
PyErr_NoMemory();
......
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