aboutsummaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-01-09 11:01:14 +1100
committerDamien George <damien.p.george@gmail.com>2020-01-09 11:25:26 +1100
commitbfbd94401d9cf658fc50b2e45896aba300a7af71 (patch)
tree21aec2207f432658083a26ed5172f9ce0e57ee43 /py/obj.h
parente3187b052f14872fdb5e2d2338d359013a544fae (diff)
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.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index f14447491..d98a0470d 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -669,7 +669,7 @@ mp_obj_t mp_obj_new_getitem_iter(mp_obj_t *args, mp_obj_iter_buf_t *iter_buf);
mp_obj_t mp_obj_new_module(qstr module_name);
mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items);
-mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in);
+const mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in);
const char *mp_obj_get_type_str(mp_const_obj_t o_in);
bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo); // arguments should be type objects
mp_obj_t mp_instance_cast_to_native_base(mp_const_obj_t self_in, mp_const_obj_t native_type);