Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue22077

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Improve the error message for various sequences
Type:enhancementStage:resolved
Components:Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: terry.reedyNosy List: Claudiu.Popa, python-dev, terry.reedy
Priority:normalKeywords:patch

Created on2014-07-26 08:52 byClaudiu.Popa, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
proper_error.patchClaudiu.Popa,2014-07-26 08:52review
Messages (3)
msg224029 -(view)Author: PCManticore (Claudiu.Popa)*(Python triager)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)(Python triager)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)*(Python committer)Date: 2014-08-02 05:32
while at it, I changed bytearray messages to include bad type as other do.
History
DateUserActionArgs
2022-04-11 14:58:06adminsetgithub: 66275
2014-08-02 05:32:25terry.reedysetstatus: open -> closed
resolution: fixed
messages: +msg224536

stage: resolved
2014-08-02 05:31:03python-devsetnosy: +python-dev
messages: +msg224535
2014-08-01 18:18:46terry.reedysetassignee:terry.reedy

nosy: +terry.reedy
2014-07-26 08:52:10Claudiu.Popacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp