Skip to content

Commit 6449d00

Browse files
committed
Avoid updating loop range during loop.
1 parent 29471e9 commit 6449d00

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Compiler/library.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,8 @@ def _range_prep(start, stop, step):
913913
step = 1
914914
if util.is_zero(step):
915915
raise CompilerError('step must not be zero')
916+
# copy to avoid update
917+
stop = type(stop)(stop)
916918
return start, stop, step
917919

918920
def range_loop(loop_body, start, stop=None, step=None):

0 commit comments

Comments
 (0)