mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
bpo-28029: Make "".replace("", s, n) returning s for any n != 0. (GH-16981)
This commit is contained in:
parent
25fc088607
commit
865c3b257f
5 changed files with 18 additions and 9 deletions
|
@ -10572,9 +10572,12 @@ replace(PyObject *self, PyObject *str1,
|
|||
int mayshrink;
|
||||
Py_UCS4 maxchar, maxchar_str1, maxchar_str2;
|
||||
|
||||
if (slen < len1)
|
||||
goto nothing;
|
||||
|
||||
if (maxcount < 0)
|
||||
maxcount = PY_SSIZE_T_MAX;
|
||||
else if (maxcount == 0 || slen == 0)
|
||||
else if (maxcount == 0)
|
||||
goto nothing;
|
||||
|
||||
if (str1 == str2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue