str.replace(a, a) is now returning str unchanged if a is a

This commit is contained in:
Victor Stinner 2011-10-07 10:01:28 +02:00
parent 72ca65dce4
commit 59de0ee9e0
2 changed files with 8 additions and 0 deletions

View file

@ -9604,6 +9604,8 @@ replace(PyObject *self, PyObject *str1,
else if (maxcount == 0 || slen == 0)
goto nothing;
if (str1 == str2)
goto nothing;
if (skind < kind1)
/* substring too wide to be present */
goto nothing;