Commit 6ea2a6ae authored by Stefan Behnel's avatar Stefan Behnel

fix constant result check in array slice assignment code

parent 0e1eeb93
......@@ -4860,15 +4860,16 @@ class SingleAssignmentNode(AssignmentNode):
step_node = None #node.step
if step_node:
step_node = step_node.coerce_to(PyrexTypes.c_py_ssize_t_type, env)
# TODO: Factor out SliceIndexNode.generate_slice_guard_code() for use here.
def get_const(node, none_value):
if node is None:
return none_value
elif node.has_constant_result:
node.calculate_constant_result()
elif node.has_constant_result():
return node.constant_result
else:
raise ValueError, "Not a constant."
raise ValueError("Not a constant.")
try:
slice_size = (get_const(stop_node, None) - get_const(start_node, 0)) / get_const(step_node, 1)
if target_size != slice_size:
......
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