You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
collections.UserString.rindex() fails to accept UserString as sub argument #140911
UserString.rindex raises a TypeError when its sub argument is a UserString object. This behavior is inconsistent with UserString.rfind and most other string methods.
For reference, __contains__, count, find and replace were fixed in 98b349f. But rfind was only fixed in da2ecaf, 2.5 years later. index and rindex were missed again.
Activity
picnixz commentedon Nov 2, 2025
I can see that there is an
isinstancecheck inrfind. It's legitimate to assume that we need one inrindex.serhiy-storchaka commentedon Nov 3, 2025
For reference,
__contains__,count,findandreplacewere fixed in 98b349f. Butrfindwas only fixed in da2ecaf, 2.5 years later.indexandrindexwere missed again.gh-140911: Ensure that UserString.index() and UserString.rindex() acc…
pythongh-140911: Ensure that UserString.index() and UserString.rindex…
pythongh-140911: Ensure that UserString.index() and UserString.rindex…
[3.13] gh-140911: Ensure that UserString.index() and UserString.rinde…
[3.14] gh-140911: Ensure that UserString.index() and UserString.rinde…
pythongh-140911: Ensure that UserString.index() and UserString.rindex…
pythongh-140911: Ensure that UserString.index() and UserString.rindex…