From 791b65f4b261a23e427664f0b86ce32b60e33cb5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 27 Sep 2016 13:34:21 +1000 Subject: py/modmicropython: Add micropython.const, alias for identity function. Having a micropython.const identity function, and writing "from micropython import const" at the start of scripts that use the const feature, allows to write scripts which are compatible with CPython, and with uPy builds that don't include const optimisation. This patch adds such a function and updates the tests to do the import. --- tests/micropython/const2.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/micropython/const2.py') diff --git a/tests/micropython/const2.py b/tests/micropython/const2.py index fb4588435..60085a1e0 100644 --- a/tests/micropython/const2.py +++ b/tests/micropython/const2.py @@ -1,5 +1,7 @@ # check that consts are not replaced in anything except standalone identifiers +from micropython import const + X = const(1) Y = const(2) Z = const(3) -- cgit v1.2.3