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: Wrong fix for range(42)[::-1]
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, theller
Priority: normal Keywords:

Created on 2008-12-11 12:01 by theller, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg77604 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-12-11 12:01
The 2to3 fixer translates this code:
    range(42)[::-1]
into this one:
    list(range(42)[::-1]
which throws an error when run with Python 3:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    print(list(range(42)[::-1]))
TypeError: sequence index must be integer, not 'slice'
msg77625 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-12-11 19:04
Thanks for the report! Fixed in r67705.
History
Date User Action Args
2022-04-11 14:56:42adminsetgithub: 48882
2008-12-11 19:04:20benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg77625
nosy: + benjamin.peterson
2008-12-11 12:01:56thellercreate