py: settrace is incompatible with Interrupt Handlers
When MICROPY_PY_SYS_SETTRACE is enabled, bytecode execution allocates RAM, which is forbidden on interrupt handlers.
https://github.com/micropython/micropython/blob/4d9e657f0ee881f4a41093ab89ec91d03613744d/py/vm.c#L142-L149
https://github.com/micropython/micropython/blob/e9e9c76ddf131f8e50b0ae2d44501d3cd88537ef/py/profile.c#L315-L318
Add means for accessing locals when MicroPython is built with sys.settrace
sys.settrace is a great step towards having a usable MicroPython debugger, but as long as it's not possible to query local variables, people can't replace their print-debugging with a debugger based on sys.settrace.
My proposal is to somehow expose locals when sys.settrace is enabled. It doesn't need to be a Dict[str, Any]. If the exact rules are published for mapping local names to positions in an array, the debugger can still present a conventional view to the user. It's alright if some locals (eg. created by constant expressions) don't end up in this array at all, as long as the rules are clear.
If something like this gets done, then I'd do my best to create a beginner-friendly MicroPython debugger for Thonny IDE.