This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 661913: inconsistent error messages between string an unicod
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: blunck2, inyeol, rhettinger
Priority: normal Keywords: patch

Created on 2003-01-08 05:27 by blunck2, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
unicodeobject.c.diff blunck2, 2003-01-08 05:29 contextual diff for unicodeobject.c
stringobject.c.diff blunck2, 2003-01-09 04:21 stringobject.c
Messages (4)
msg42368 - (view) Author: Christopher Blunck (blunck2) Date: 2003-01-08 05:27
'a'.index('b'):   substring not found in index
u'a'.index('b'): substring not found     (bah!)

same thing follows for rindex.

changed unicodeobject.c to return same error message as
what string returns.

msg42369 - (view) Author: Inyeol Lee (inyeol) Date: 2003-01-08 18:45
Logged In: YES 
user_id=595280

Hmm... I think the patch should be in the
opposite direction - leaving unicode message
as is and fix stringobject.c to make the
message the same as unicode. I've scanned
all the exception messages in string methods
and (r)index() is the only method which contains
method name in its exception message. For example,

>>> 'a'.split('')
ValueError: empty separator
msg42370 - (view) Author: Christopher Blunck (blunck2) Date: 2003-01-08 21:08
Logged In: YES 
user_id=531881

Probably a good idea inyeol.  Will post a follow-up patch
tonight.  Thanks.
msg42371 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-01-15 05:37
Logged In: YES 
user_id=80475

Fixed.
See /Objects/stringobject.c 2.204.
Thanks for the patch.
History
Date User Action Args
2022-04-10 16:06:07adminsetgithub: 37740
2003-01-08 05:27:35blunck2create