Commit 4f0ff235 authored by Stefan Behnel's avatar Stefan Behnel

disable incorrect optimisation and enable tests for reversed iteration with negative step value

parent 05464697
...@@ -661,6 +661,9 @@ class IterationTransform(Visitor.EnvTransform): ...@@ -661,6 +661,9 @@ class IterationTransform(Visitor.EnvTransform):
if reversed: if reversed:
bound1, bound2 = bound2, bound1 bound1, bound2 = bound2, bound1
if step_value < 0: if step_value < 0:
if step_value != -1:
# FIXME: not currently supported
return node
step_value = -step_value step_value = -step_value
if step_value != 1: if step_value != 1:
begin_value = bound1.constant_result begin_value = bound1.constant_result
......
...@@ -253,9 +253,9 @@ def reversed_range_constant(): ...@@ -253,9 +253,9 @@ def reversed_range_constant():
@cython.test_assert_path_exists('//ForFromStatNode') @cython.test_assert_path_exists('//ForFromStatNode')
@cython.test_fail_if_path_exists('//ForInStatNode') #@cython.test_fail_if_path_exists('//ForInStatNode')
def FIXME_reversed_range_constant_neg(): def reversed_range_constant_neg():
FIXME = """ """
>>> [ i for i in _reversed(range(-2, -12, -4)) ] >>> [ i for i in _reversed(range(-2, -12, -4)) ]
[-10, -6, -2] [-10, -6, -2]
>>> reversed_range_constant_neg() >>> reversed_range_constant_neg()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment