← index #17547Issue #17467
Related · high · value 2.570
QUERY · ISSUE

mpy-cross: Assertion failed when compiling tests/basics/exception_chain.py.

openby agattiopened 2025-06-22updated 2025-12-23
bug

Port, board and/or hardware

Unix on Linux/amd64

MicroPython version

MicroPython v1.26.0-preview.261.gbcc8d4ee1.dirty on 2025-06-22; linux [GCC 15.1.1] version

Reproduction

  1. Build mpy-cross with no special flags (make -C mpy-cross clean && make -C mpy-cross)
  2. Compile tests/basics/exception_chain.py into native code (arch does not matter) with mpy-cross -X emit=native -march=debug tests/basics/exception_chain.py
  3. mpy-cross will crash.

Expected behaviour

Compiling tests/basics/exception_chain.py should not crash mpy-cross.

Observed behaviour

mpy-cross crashes with:

mpy-cross: ../py/emitnative.c:2947: emit_native_raise_varargs: Assertion `n_args == 1' failed.`

Additional Information

If having a multi-arg exception is not supported for native code compilation, then an error message should be printed rather than crashing the compiler.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

mpy-cross: Assertion failed for `-march=debug` and Viper code

closedby agattiopened 2025-06-09updated 2025-06-16
bugpy-core

Port, board and/or hardware

mpy-cross on Linux/amd64

MicroPython version

MicroPython v1.26.0-preview.196.g5f058e986 on 2025-06-09; linux [GCC 15.1.1] version

Reproduction

  1. Build mpy-cross without any special flags or parameters (as in, make -C mpy-cross clean && make -C mpy-cross
  2. Run ./mpy-cross/build/mpy-cross -march=debug ./tests/micropython/viper_ptr16_store.py

Expected behaviour

mpy-cross should not crash on exit but terminate gracefully.

Observed behaviour

mpy-cross will crash with:

mpy-cross: ../py/asmbase.c:56: mp_asm_base_start_pass: Assertion `as->code_base != NULL' failed.

after dumping native meta-opcodes to STDOUT.

Additional Information

This only happens for Viper code. For example, dumping tests/micropython/native_closure.py or tests/micropython/meminfo.py doesn't trigger the assertion.

I haven't really looked into this, but it seems like Viper code would still trigger an emit pass even for the debug arch? This could probably be fixed if N_DEBUG would be propagated into py/asmbase.c too but it doesn't seem to be the case.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied