summaryrefslogtreecommitdiffstatshomepage
path: root/tools/mpy-tool.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-02-17 00:19:34 +1100
committerDamien George <damien.p.george@gmail.com>2017-02-17 00:19:34 +1100
commit6a11048af1d01c78bdacddadd1b72dc7ba7c6478 (patch)
tree0a84ed78a6fc053dd2c5beecaeb25203b9fb5273 /tools/mpy-tool.py
parentc26441474686a5fac93c82d9759b7ed91bed2978 (diff)
downloadmicropython-6a11048af1d01c78bdacddadd1b72dc7ba7c6478.tar.gz
micropython-6a11048af1d01c78bdacddadd1b72dc7ba7c6478.zip
py/persistentcode: Bump .mpy version due to change in bytecode.
Diffstat (limited to 'tools/mpy-tool.py')
-rwxr-xr-xtools/mpy-tool.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index ce373a4f5b..d14e0f4ea4 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -57,6 +57,7 @@ class FreezeError(Exception):
return 'error while freezing %s: %s' % (self.rawcode.source_file, self.msg)
class Config:
+ MPY_VERSION = 1
MICROPY_LONGINT_IMPL_NONE = 0
MICROPY_LONGINT_IMPL_LONGLONG = 1
MICROPY_LONGINT_IMPL_MPZ = 2
@@ -438,8 +439,8 @@ def read_mpy(filename):
header = bytes_cons(f.read(4))
if header[0] != ord('M'):
raise Exception('not a valid .mpy file')
- if header[1] != 0:
- raise Exception('incompatible version')
+ if header[1] != config.MPY_VERSION:
+ raise Exception('incompatible .mpy version')
feature_flags = header[2]
config.MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE = (feature_flags & 1) != 0
config.MICROPY_PY_BUILTINS_STR_UNICODE = (feature_flags & 2) != 0