Commit 015f0264 authored by Stefan Behnel's avatar Stefan Behnel

Discard loop variable resetting in ForFromStatNode for Python loop variables...

Discard loop variable resetting in ForFromStatNode for Python loop variables also after the range() optimisation (was previously implied).
parent 77761743
......@@ -6524,7 +6524,7 @@ class ForFromStatNode(LoopNode, StatNode):
self.body.generate_execution_code(code)
code.put_label(code.continue_label)
if self.py_loopvar_node:
if not from_range and self.py_loopvar_node:
# This mess is to make for..from loops with python targets behave
# exactly like those with C targets with regards to re-assignment
# of the loop variable.
......@@ -6559,7 +6559,7 @@ class ForFromStatNode(LoopNode, StatNode):
code.putln("}")
if self.py_loopvar_node:
if not from_range and self.py_loopvar_node:
# This is potentially wasteful, but we don't want the semantics to
# depend on whether or not the loop is a python type.
self.py_loopvar_node.generate_evaluation_code(code)
......
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