Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/basics/for3.py

12 lines
261 B
Python
Raw Normal View History

tests: Add test for semantics of for-loop that optimisation can break.
2014-12-11 17:40:41 +00:00
# test assigning to iterator within the loop
for i in range(2):
print(i)
i = 2
# test assigning to range parameter within the loop
# (since we optimise for loops, this needs checking, currently it fails)
py: Fix optimised for-loop compiler so it follows proper semantics. You can now assign to the range end variable and the for-loop still works correctly. This fully addresses issue #565. Also fixed a bug with the stack not being fully popped when breaking out of an optimised for-loop (and it's actually impossible to write a test for this case!).
2014-12-12 17:19:56 +00:00
n = 2
for i in range(n):
print(i)
n = 0
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 189ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API