summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2011-10-07 08:01:28 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2011-10-07 08:01:28 (GMT)
commit59de0ee9e087a819a0a63b31c1391c6eee55b8ef (patch)
treea460b0d2c099e04b6dbc661c90227fe3daa30d3d /Objects/unicodeobject.c
parent72ca65dce4529906b64710e94a3c004f9cc2712f (diff)
downloadcpython-59de0ee9e087a819a0a63b31c1391c6eee55b8ef.zip
cpython-59de0ee9e087a819a0a63b31c1391c6eee55b8ef.tar.gz
cpython-59de0ee9e087a819a0a63b31c1391c6eee55b8ef.tar.bz2
str.replace(a, a) is now returning str unchanged if a is a
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index caad326..8608776 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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;