Bug report
Bug description:
str.index() and str.rindex() get the error message as shown below:
v = str('Hello')
print(v.index('abc'))
print(v.rindex('abc'))
# ValueError: substring not found
But bytes.index() and bytes.rindex() get the different error message as shown below:
v = bytes(b'Hello')
print(v.index(b'abc'))
print(v.rindex(b'abc'))
# ValueError: subsection not found
And, bytearray.index() and bytearray.rindex() also get the different error message as shown below:
v = bytearray(b'Hello')
print(v.index(b'abc'))
print(v.rindex(b'abc'))
# ValueError: subsection not found
So, the error message of them should be the same for consistency as shown below:
ValueError: substring not found
Or:
ValueError: subsection not found
CPython versions tested on:
3.12
Operating systems tested on:
Windows