micropython/tests/micropython
Jim Mussared a64f2fdca0 py/dynruntime.h: Implement MP_OBJ_NEW_QSTR.
Because mpy_ld.py doesn't know the target object representation, it emits
instances of `MP_OBJ_NEW_QSTR(MP_QSTR_Foo)` as const string objects, rather
than qstrs. However this doesn't work for map keys (e.g. for a locals dict)
because the map has all_keys_are_qstrs flag is set (and also auto-complete
requires the map keys to be qstrs).

Instead, emit them as regular qstrs, and make a functioning MP_OBJ_NEW_QSTR
function available (via `native_to_obj`, also used for e.g. making
integers).

Remove the code from mpy_ld.py to emit qstrs as constant strings, but leave
behind the scaffold to emit constant objects in case we want to do use this
in the future.

Strictly this should be a .mpy sub-version bump, even though the function
table isn't changing, it does lead to a change in behavior for a new .mpy
running against old MicroPython. `mp_native_to_obj` will incorrectly return
the qstr value directly as an `mp_obj_t`, leading to unexpected results.
But given that it's broken at the moment, it seems unlikely that anyone is
relying on this, so it's not work the other downsides of a sub-version bump
(i.e. breaking pure-Python modules that use @native). The opposite case of
running an old .mpy on new MicroPython is unchanged, and remains broken in
exactly the same way.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-01 16:14:22 +10:00
..
builtin_execfile.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
builtin_execfile.py.exp
const.py
const.py.exp
const2.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
const2.py.exp
const_alltypes.py
const_alltypes.py.exp
const_error.py
const_error.py.exp
const_intbig.py
const_intbig.py.exp
decorator.py
decorator.py.exp
decorator_error.py
decorator_error.py.exp
emg_exc.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
emg_exc.py.exp
extreme_exc.py
extreme_exc.py.exp
heap_lock.py
heap_lock.py.exp
heap_locked.py
heap_locked.py.exp
heapalloc.py
heapalloc.py.exp
heapalloc_bytesio.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
heapalloc_bytesio.py.exp
heapalloc_bytesio2.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
heapalloc_bytesio2.py.exp
heapalloc_exc_compressed.py
heapalloc_exc_compressed.py.exp
heapalloc_exc_compressed_emg_exc.py
heapalloc_exc_compressed_emg_exc.py.exp
heapalloc_exc_raise.py
heapalloc_exc_raise.py.exp
heapalloc_fail_bytearray.py
heapalloc_fail_bytearray.py.exp
heapalloc_fail_dict.py
heapalloc_fail_dict.py.exp
heapalloc_fail_list.py
heapalloc_fail_list.py.exp
heapalloc_fail_memoryview.py
heapalloc_fail_memoryview.py.exp
heapalloc_fail_set.py
heapalloc_fail_set.py.exp
heapalloc_fail_tuple.py
heapalloc_fail_tuple.py.exp
heapalloc_inst_call.py
heapalloc_inst_call.py.exp
heapalloc_int_from_bytes.py
heapalloc_int_from_bytes.py.exp
heapalloc_iter.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
heapalloc_str.py
heapalloc_str.py.exp
heapalloc_super.py
heapalloc_super.py.exp
heapalloc_traceback.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
heapalloc_traceback.py.exp
heapalloc_yield_from.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
heapalloc_yield_from.py.exp
import_mpy_invalid.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
import_mpy_invalid.py.exp
import_mpy_native.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
import_mpy_native.py.exp
import_mpy_native_gc.py py/dynruntime.h: Implement MP_OBJ_NEW_QSTR. 2023-09-01 16:14:22 +10:00
import_mpy_native_gc.py.exp
kbd_intr.py
kbd_intr.py.exp
meminfo.py
meminfo.py.exp
memstats.py
memstats.py.exp
native_closure.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
native_closure.py.exp
native_const.py
native_const.py.exp
native_const_intbig.py
native_const_intbig.py.exp
native_for.py
native_for.py.exp
native_fun_attrs.py
native_fun_attrs.py.exp
native_gen.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
native_gen.py.exp
native_misc.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
native_misc.py.exp
native_try.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
native_try.py.exp
native_try_deep.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
native_try_deep.py.exp
native_while.py
native_while.py.exp
native_with.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
native_with.py.exp
opt_level.py
opt_level.py.exp
opt_level_lineno.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
opt_level_lineno.py.exp
schedule.py
schedule.py.exp
stack_use.py
stack_use.py.exp
viper_addr.py
viper_addr.py.exp
viper_args.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
viper_args.py.exp
viper_binop_arith.py
viper_binop_arith.py.exp
viper_binop_arith_uint.py
viper_binop_arith_uint.py.exp
viper_binop_bitwise_uint.py
viper_binop_bitwise_uint.py.exp
viper_binop_comp.py
viper_binop_comp.py.exp
viper_binop_comp_imm.py
viper_binop_comp_imm.py.exp
viper_binop_comp_uint.py
viper_binop_comp_uint.py.exp
viper_binop_divmod.py
viper_binop_divmod.py.exp
viper_binop_multi_comp.py
viper_binop_multi_comp.py.exp
viper_cond.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
viper_cond.py.exp
viper_const.py
viper_const.py.exp
viper_const_intbig.py
viper_const_intbig.py.exp
viper_error.py
viper_error.py.exp
viper_globals.py
viper_globals.py.exp
viper_import.py
viper_import.py.exp
viper_misc.py tests/micropython: Split viper_misc test into two files. 2023-02-09 16:12:25 +11:00
viper_misc.py.exp tests/micropython: Split viper_misc test into two files. 2023-02-09 16:12:25 +11:00
viper_misc2.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
viper_misc2.py.exp
viper_misc3.py tests/micropython: Split viper_misc test into two files. 2023-02-09 16:12:25 +11:00
viper_misc3.py.exp tests/micropython: Split viper_misc test into two files. 2023-02-09 16:12:25 +11:00
viper_misc_intbig.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
viper_misc_intbig.py.exp
viper_ptr8_load.py
viper_ptr8_load.py.exp
viper_ptr8_store.py
viper_ptr8_store.py.exp
viper_ptr16_load.py
viper_ptr16_load.py.exp
viper_ptr16_store.py
viper_ptr16_store.py.exp
viper_ptr32_load.py
viper_ptr32_load.py.exp
viper_ptr32_store.py
viper_ptr32_store.py.exp
viper_storeattr.py
viper_storeattr.py.exp
viper_subscr.py
viper_subscr.py.exp
viper_subscr_multi.py py/emitnative: Ensure load_subscr does not clobber existing REG_ARG_2. 2022-11-11 12:25:32 +11:00
viper_subscr_multi.py.exp py/emitnative: Ensure load_subscr does not clobber existing REG_ARG_2. 2022-11-11 12:25:32 +11:00
viper_try.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
viper_try.py.exp
viper_types.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
viper_types.py.exp
viper_with.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
viper_with.py.exp