py/runtime: Add helpers to call a general function on nlr jump callback.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-09-05 18:12:26 +10:00
parent dc99840b3a
commit c9089e71a1
2 changed files with 20 additions and 0 deletions

View File

@@ -197,6 +197,11 @@ void mp_globals_locals_set_from_nlr_jump_callback(void *ctx_in) {
mp_locals_set(ctx->locals);
}
void mp_call_function_1_from_nlr_jump_callback(void *ctx_in) {
nlr_jump_callback_node_call_function_1_t *ctx = ctx_in;
ctx->func(ctx->arg);
}
mp_obj_t MICROPY_WRAP_MP_LOAD_NAME(mp_load_name)(qstr qst) {
// logic: search locals, globals, builtins
DEBUG_OP_printf("load name %s\n", qstr_str(qst));