
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-07-26 08:52 byClaudiu.Popa, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| proper_error.patch | Claudiu.Popa,2014-07-26 08:52 | review | ||
| Messages (3) | |||
|---|---|---|---|
| msg224029 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-07-26 08:52 | |
For a couple of sequences (bytes, list, tuple, bytearray), the error when using an invalid sequence index is misleading, because it says that only integers are allowed, while slices are allowed too.>>> a = []>>> a['python']Traceback (most recent call last): File "<stdin>", line 1, in <module>TypeError: list indices must be integers, not str>>>For instance, here's how range does it:>>> range(1)['a']Traceback (most recent call last): File "<stdin>", line 1, in <module>TypeError: range indices must be integers or slices, not strThe attached patch improves these error messages. | |||
| msg224535 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-08-02 05:31 | |
New changeset02d6d3a7a181 by Terry Jan Reedy in branch 'default':Issue#22077: Improve index error messages for bytearrays, bytes, lists, andhttp://hg.python.org/cpython/rev/02d6d3a7a181 | |||
| msg224536 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2014-08-02 05:32 | |
while at it, I changed bytearray messages to include bad type as other do. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:06 | admin | set | github: 66275 |
| 2014-08-02 05:32:25 | terry.reedy | set | status: open -> closed resolution: fixed messages: +msg224536 stage: resolved |
| 2014-08-02 05:31:03 | python-dev | set | nosy: +python-dev messages: +msg224535 |
| 2014-08-01 18:18:46 | terry.reedy | set | assignee:terry.reedy nosy: +terry.reedy |
| 2014-07-26 08:52:10 | Claudiu.Popa | create | |