gh-106487: Allow the 'count' argument of str.replace to be a keyword (#106488)

This commit is contained in:
Hugo van Kemenade 2023-07-10 12:52:36 +03:00 committed by GitHub
parent dac1e36490
commit 34c14147a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 14 deletions

View file

@ -12025,10 +12025,10 @@ str.replace as unicode_replace
old: unicode
new: unicode
/
count: Py_ssize_t = -1
Maximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.
/
Return a copy with all occurrences of substring old replaced by new.
@ -12039,7 +12039,7 @@ replaced.
static PyObject *
unicode_replace_impl(PyObject *self, PyObject *old, PyObject *new,
Py_ssize_t count)
/*[clinic end generated code: output=b63f1a8b5eebf448 input=147d12206276ebeb]*/
/*[clinic end generated code: output=b63f1a8b5eebf448 input=3345c455d60a5499]*/
{
return replace(self, old, new, count);
}