From a5bda23aaa833245362cee3a5e8058540440f2c2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 15 Jan 2026 18:29:30 +1100 Subject: [PATCH] py/emitglue: Check for bytecode with MICROPY_PY_FUNCTION_ATTRS_CODE. When `MICROPY_PY_FUNCTION_ATTRS_CODE` is enabled, constructing a function instance through `fun_bc_make_new()` can call `mp_make_function_from_proto_fun()` with pure bytecode as the proto-fun. Signed-off-by: Damien George --- py/emitglue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/emitglue.c b/py/emitglue.c index a72f94c88b..6a1816c2c7 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -183,7 +183,7 @@ mp_obj_t mp_make_function_from_proto_fun(mp_proto_fun_t proto_fun, const mp_modu // def_kw_args must be MP_OBJ_NULL or a dict assert(def_args == NULL || def_args[1] == MP_OBJ_NULL || mp_obj_is_type(def_args[1], &mp_type_dict)); - #if MICROPY_MODULE_FROZEN_MPY + #if MICROPY_MODULE_FROZEN_MPY || MICROPY_PY_FUNCTION_ATTRS_CODE if (mp_proto_fun_is_bytecode(proto_fun)) { const uint8_t *bc = proto_fun; mp_obj_t fun = mp_obj_new_fun_bc(def_args, bc, context, NULL);