summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/for2.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-31 18:02:22 +0100
committerDamien George <damien.p.george@gmail.com>2014-03-31 18:02:22 +0100
commit3ff2d038912cba10f856f47cefbabf68f84cb098 (patch)
tree41b4bb5d0214d8c0e8c0794911695119a104737d /tests/basics/for2.py
parent8cd72bdf92fc8d8d735e332295e9582ae20bbaef (diff)
downloadmicropython-3ff2d038912cba10f856f47cefbabf68f84cb098.tar.gz
micropython-3ff2d038912cba10f856f47cefbabf68f84cb098.zip
py: Fix bug in optimised for .. range.
Don't store final, failing value to the loop variable. This fix also makes for .. range a bit more efficient, as it uses less store/load pairs for the loop variable.
Diffstat (limited to 'tests/basics/for2.py')
-rw-r--r--tests/basics/for2.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/basics/for2.py b/tests/basics/for2.py
new file mode 100644
index 0000000000..62f056e760
--- /dev/null
+++ b/tests/basics/for2.py
@@ -0,0 +1,8 @@
+i = 'init'
+for i in range(0):
+ pass
+print(i) # should not have been modified
+
+for i in range(10):
+ pass
+print(i) # should be last successful value of loop