[issue6780] startswith error message is incomplete

Ezio Melotti report at bugs.python.org
Sun Mar 14 08:18:46 CET 2010


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

Here is a proof of concept that solves the problem for unicode strings and startswith/endswith.
If during the conversion to Unicode a TypeError is raised (e.g. TypeError: Can't convert 'list' object to str implicitly), the error message is changed to "TypeError: startswith first arg must be str, unicode, or tuple, not list".
If the error is not a TypeError (e.g. a UnicodeDecodeError) the behavior is unchanged.
I haven't tested the patch thoroughly, but if this approach is OK I will prepare a complete patch.

----------
keywords: +patch
Added file: http://bugs.python.org/file16538/issue6780.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6780>
_______________________________________


More information about the Python-bugs-list mailing list