[issue35077] Make TypeError message less ambiguous

Karthikeyan Singaravelan report at bugs.python.org
Fri Oct 26 13:34:56 EDT 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Thanks for the report. Error message changes are generally done on master and not back ported. I am removing 3.5 which is security fixes only mode and adding 3.8 . There are other errors of similar format but indicate the wrong type in the error message like list indices.

$ ./python.exe
Python 3.8.0a0 (heads/bpo31177-dirty:19986202a8, Oct 26 2018, 22:19:23)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> [1]['1']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list indices must be integers or slices, not str

I think we should also assert the error message in test_slice (Lib/test/string_tests.py) if there is a change.

Thanks Serhiy, I was about to add Raymond too who might have thoughts on the wording :)

----------
nosy: +xtreak
versions: +Python 3.8 -Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35077>
_______________________________________


More information about the Python-bugs-list mailing list