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
Gwenaël Samain
cython
Commits
6ea2a6ae
Commit
6ea2a6ae
authored
Nov 04, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix constant result check in array slice assignment code
parent
0e1eeb93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-5
No files found.
Cython/Compiler/Nodes.py
View file @
6ea2a6ae
...
@@ -4860,15 +4860,16 @@ class SingleAssignmentNode(AssignmentNode):
...
@@ -4860,15 +4860,16 @@ class SingleAssignmentNode(AssignmentNode):
step_node
=
None
#node.step
step_node
=
None
#node.step
if
step_node
:
if
step_node
:
step_node
=
step_node
.
coerce_to
(
PyrexTypes
.
c_py_ssize_t_type
,
env
)
step_node
=
step_node
.
coerce_to
(
PyrexTypes
.
c_py_ssize_t_type
,
env
)
# TODO: Factor out SliceIndexNode.generate_slice_guard_code() for use here.
# TODO: Factor out SliceIndexNode.generate_slice_guard_code() for use here.
def
get_const
(
node
,
none_value
):
def
get_const
(
node
,
none_value
):
if
node
is
None
:
if
node
is
None
:
return
none_value
return
none_value
elif
node
.
has_constant_result
:
elif
node
.
has_constant_result
():
node
.
calculate_constant_result
()
return
node
.
constant_result
return
node
.
constant_result
else
:
else
:
raise
ValueError
,
"Not a constant."
raise
ValueError
(
"Not a constant."
)
try
:
try
:
slice_size
=
(
get_const
(
stop_node
,
None
)
-
get_const
(
start_node
,
0
))
/
get_const
(
step_node
,
1
)
slice_size
=
(
get_const
(
stop_node
,
None
)
-
get_const
(
start_node
,
0
))
/
get_const
(
step_node
,
1
)
if
target_size
!=
slice_size
:
if
target_size
!=
slice_size
:
...
...
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