Skip to content

gh-117431: Amend str method signatures after PR #117468 #117590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Objects/clinic/unicodeobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -11254,6 +11254,7 @@ unicode_expandtabs_impl(PyObject *self, int tabsize)
}

/*[clinic input]
@text_signature "($self, sub[, start[, end]], /)"
str.find as unicode_find = str.count

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Expand All @@ -11265,7 +11266,7 @@ Return -1 on failure.
static Py_ssize_t
unicode_find_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
Py_ssize_t end)
/*[clinic end generated code: output=51dbe6255712e278 input=4a89d2d68ef57256]*/
/*[clinic end generated code: output=51dbe6255712e278 input=94138bf5531ee2c2]*/
{
Py_ssize_t result = any_find_slice(str, substr, start, end, 1);
if (result < 0) {
Expand Down Expand Up @@ -11315,6 +11316,7 @@ unicode_hash(PyObject *self)
}

/*[clinic input]
@text_signature "($self, sub[, start[, end]], /)"
str.index as unicode_index = str.count

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Expand All @@ -11326,7 +11328,7 @@ Raises ValueError when the substring is not found.
static Py_ssize_t
unicode_index_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
Py_ssize_t end)
/*[clinic end generated code: output=77558288837cdf40 input=d986aeac0be14a1c]*/
/*[clinic end generated code: output=77558288837cdf40 input=5d36d2214563e75f]*/
{
Py_ssize_t result = any_find_slice(str, substr, start, end, 1);
if (result == -1) {
Expand Down Expand Up @@ -12416,6 +12418,7 @@ unicode_repr(PyObject *unicode)
}

/*[clinic input]
@text_signature "($self, sub[, start[, end]], /)"
str.rfind as unicode_rfind = str.count

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Expand All @@ -12427,7 +12430,7 @@ Return -1 on failure.
static Py_ssize_t
unicode_rfind_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
Py_ssize_t end)
/*[clinic end generated code: output=880b29f01dd014c8 input=898361fb71f59294]*/
/*[clinic end generated code: output=880b29f01dd014c8 input=6be966f58a917351]*/
{
Py_ssize_t result = any_find_slice(str, substr, start, end, -1);
if (result < 0) {
Expand All @@ -12437,6 +12440,7 @@ unicode_rfind_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
}

/*[clinic input]
@text_signature "($self, sub[, start[, end]], /)"
str.rindex as unicode_rindex = str.count

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Expand All @@ -12448,7 +12452,7 @@ Raises ValueError when the substring is not found.
static Py_ssize_t
unicode_rindex_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
Py_ssize_t end)
/*[clinic end generated code: output=5f3aef124c867fe1 input=35943dead6c1ea9d]*/
/*[clinic end generated code: output=5f3aef124c867fe1 input=a931a2e77feb5e47]*/
{
Py_ssize_t result = any_find_slice(str, substr, start, end, -1);
if (result == -1) {
Expand Down