Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
4f0ff235
Commit
4f0ff235
authored
Dec 27, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable incorrect optimisation and enable tests for reversed iteration with negative step value
parent
05464697
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+3
-0
tests/run/reversed_iteration.pyx
tests/run/reversed_iteration.pyx
+3
-3
No files found.
Cython/Compiler/Optimize.py
View file @
4f0ff235
...
@@ -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
...
...
tests/run/reversed_iteration.pyx
View file @
4f0ff235
...
@@ -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()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment