Skip to content

Commit 40f7e9c

Browse files
stinosdpgeorge
authored andcommittedApr 22, 2024
py/objfun: Fix C++ compatibility with casting in inline functions.
Explicit casts are needed. Fixes recent changes from 648a757 and 9400229. Signed-off-by: stijn <[email protected]>
1 parent 3129b69 commit 40f7e9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎py/objfun.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ void mp_obj_fun_bc_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
5656
#if MICROPY_EMIT_NATIVE
5757

5858
static inline mp_obj_t mp_obj_new_fun_native(const mp_obj_t *def_args, const void *fun_data, const mp_module_context_t *mc, struct _mp_raw_code_t *const *child_table) {
59-
mp_obj_fun_bc_t *o = MP_OBJ_TO_PTR(mp_obj_new_fun_bc(def_args, (const byte *)fun_data, mc, child_table));
59+
mp_obj_fun_bc_t *o = (mp_obj_fun_bc_t *)MP_OBJ_TO_PTR(mp_obj_new_fun_bc(def_args, (const byte *)fun_data, mc, child_table));
6060
o->base.type = &mp_type_fun_native;
6161
return MP_OBJ_FROM_PTR(o);
6262
}
6363

6464
static inline mp_obj_t mp_obj_new_fun_viper(const void *fun_data, const mp_module_context_t *mc, struct _mp_raw_code_t *const *child_table) {
6565
mp_obj_fun_bc_t *o = mp_obj_malloc(mp_obj_fun_bc_t, &mp_type_fun_viper);
66-
o->bytecode = fun_data;
66+
o->bytecode = (const byte *)fun_data;
6767
o->context = mc;
6868
o->child_table = child_table;
6969
return MP_OBJ_FROM_PTR(o);
@@ -101,9 +101,9 @@ static inline void *mp_obj_fun_native_get_generator_resume(const mp_obj_fun_bc_t
101101

102102
#if MICROPY_EMIT_INLINE_ASM
103103
static inline mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_sig) {
104-
mp_obj_fun_asm_t *o = mp_obj_malloc(mp_obj_fun_asm_t, &mp_type_fun_asm);
104+
mp_obj_fun_asm_t *o = (mp_obj_fun_asm_t *)mp_obj_malloc(mp_obj_fun_asm_t, &mp_type_fun_asm);
105105
o->n_args = n_args;
106-
o->fun_data = fun_data;
106+
o->fun_data = (const byte *)fun_data;
107107
o->type_sig = type_sig;
108108
return MP_OBJ_FROM_PTR(o);
109109
}

0 commit comments

Comments
 (0)
Please sign in to comment.