diff options
author | Damien George <damien@micropython.org> | 2022-05-16 19:20:52 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-05-17 12:51:54 +1000 |
commit | c49d5207e9437755be364639632be31c001955a8 (patch) | |
tree | 3eb8ea6a6af8231c252b5e50173a5d34e5db2390 /py/persistentcode.h | |
parent | b295b6f1f3dd529eea564b9e08b75c7ab4f48ce4 (diff) | |
download | micropython-c49d5207e9437755be364639632be31c001955a8.tar.gz micropython-c49d5207e9437755be364639632be31c001955a8.zip |
py/persistentcode: Remove unicode feature flag from .mpy file.
Prior to this commit, even with unicode disabled .py and .mpy files could
contain unicode characters, eg by entering them directly in a string as
utf-8 encoded.
The only thing the compiler disallowed (with unicode disabled) was using
\uxxxx and \Uxxxxxxxx notation to specify a character within a string with
value >= 0x100; that would give a SyntaxError.
With this change mpy-cross will now accept \u and \U notation to insert a
character with value >= 0x100 into a string (because the -mno-unicode
option is now gone, there's no way to forbid this). The runtime will
happily work with strings with such characters, just like it already works
with strings with characters that were utf-8 encoded directly.
This change simplifies things because there are no longer any feature
flags in .mpy files, and any bytecode .mpy will now run on any target.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/persistentcode.h')
-rw-r--r-- | py/persistentcode.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/py/persistentcode.h b/py/persistentcode.h index 37263f66b3..55428e73a6 100644 --- a/py/persistentcode.h +++ b/py/persistentcode.h @@ -42,15 +42,11 @@ #define MPY_FEATURE_DECODE_ARCH(feat) ((feat) >> 2) // The feature flag bits encode the compile-time config options that affect -// the generate bytecode. Note: position 0 is now unused -// (formerly MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE). -#define MPY_FEATURE_FLAGS ( \ - ((MICROPY_PY_BUILTINS_STR_UNICODE) << 1) \ - ) +// the generate bytecode. Note: no longer used. +// (formerly MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE and MICROPY_PY_BUILTINS_STR_UNICODE). +#define MPY_FEATURE_FLAGS (0) // This is a version of the flags that can be configured at runtime. -#define MPY_FEATURE_FLAGS_DYNAMIC ( \ - ((MICROPY_PY_BUILTINS_STR_UNICODE_DYNAMIC) << 1) \ - ) +#define MPY_FEATURE_FLAGS_DYNAMIC (0) // Define the host architecture #if MICROPY_EMIT_X86 |