-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-140911: Ensure that UserString.rindex(), UserString.index() accept UserString as sub argument.
#140945
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
Conversation
UserString.rindex(), UserString.index() accept UserString as sub argument.UserString.rindex(), UserString.index() accept UserString as sub argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Closes: in description! so that it directly links to main issue (like below)
Add isinstance check to both methods index(), rindex()
Closes: #140911
|
@serhiy-storchaka can you please review this... |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add tests?
Look at test_find, test_rfind and test_count methods in Lib/test/string_tests.py and add similar double loops in test_index and test_rindex.
|
cpython/Lib/test/string_tests.py Line 173 in da1d468
cpython/Lib/test/string_tests.py Line 177 in da1d468
are the leading whitespaces just before |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
Thank you for your contribution, @XChaitanyaX.
|
Thanks @XChaitanyaX for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @XChaitanyaX for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…() accept UserString as argument (pythonGH-140945) (cherry picked from commit e6174ee) Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
|
GH-141945 is a backport of this pull request to the 3.13 branch. |
…() accept UserString as argument (pythonGH-140945) (cherry picked from commit e6174ee) Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
|
GH-141946 is a backport of this pull request to the 3.14 branch. |
Add
isinstancecheck to both methodsindex(),rindex()collections.UserString.rindex()fails to acceptUserStringassubargument #140911