strop_replace(): balk if the pattern string is empty.
This commit is contained in:
parent
ed33a3f415
commit
4ccda15cd3
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue