diff options
author | Damien George <damien.p.george@gmail.com> | 2020-01-09 11:01:14 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-01-09 11:25:26 +1100 |
commit | bfbd94401d9cf658fc50b2e45896aba300a7af71 (patch) | |
tree | 21aec2207f432658083a26ed5172f9ce0e57ee43 /py/objtuple.c | |
parent | e3187b052f14872fdb5e2d2338d359013a544fae (diff) | |
download | micropython-bfbd94401d9cf658fc50b2e45896aba300a7af71.tar.gz micropython-bfbd94401d9cf658fc50b2e45896aba300a7af71.zip |
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/objtuple.c')
-rw-r--r-- | py/objtuple.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objtuple.c b/py/objtuple.c index 740e0795b3..10a5e586f6 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -105,7 +105,7 @@ STATIC mp_obj_t mp_obj_tuple_make_new(const mp_obj_type_t *type_in, size_t n_arg // Don't pass MP_BINARY_OP_NOT_EQUAL here STATIC mp_obj_t tuple_cmp_helper(mp_uint_t op, mp_obj_t self_in, mp_obj_t another_in) { mp_check_self(mp_obj_is_tuple_compatible(self_in)); - mp_obj_type_t *another_type = mp_obj_get_type(another_in); + const mp_obj_type_t *another_type = mp_obj_get_type(another_in); mp_obj_tuple_t *self = MP_OBJ_TO_PTR(self_in); if (another_type->getiter != mp_obj_tuple_getiter) { // Slow path for user subclasses |