From bfbd94401d9cf658fc50b2e45896aba300a7af71 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 9 Jan 2020 11:01:14 +1100 Subject: py: Make mp_obj_get_type() return a const ptr to mp_obj_type_t. Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer, so enforce this const-ness throughout the code base. If a type ever needs to be modified (eg a user type) then a simple cast can be used. --- py/objfun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/objfun.c') diff --git a/py/objfun.c b/py/objfun.c index 7051f3476..984d2000a 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -455,7 +455,7 @@ STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) { size_t l; return (mp_uint_t)mp_obj_str_get_data(obj, &l); } else { - mp_obj_type_t *type = mp_obj_get_type(obj); + const mp_obj_type_t *type = mp_obj_get_type(obj); #if MICROPY_PY_BUILTINS_FLOAT if (type == &mp_type_float) { // convert float to int (could also pass in float registers) -- cgit v1.2.3