py/obj: Add accessors for type slots and use everywhere.

This is a no-op, but sets the stage for changing the mp_obj_type_t
representation.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2021-07-14 17:14:16 +10:00
committed by Damien George
parent e8355eb163
commit a52cd5b07d
27 changed files with 207 additions and 188 deletions

View File

@@ -150,7 +150,7 @@ static inline mp_obj_t mp_obj_cast_to_native_base_dyn(mp_obj_t self_in, mp_const
if (MP_OBJ_FROM_PTR(self_type) == native_type) {
return self_in;
} else if (self_type->parent != native_type) {
} else if (MP_OBJ_TYPE_GET_SLOT_OR_NULL(self_type, parent) != native_type) {
// The self_in object is not a direct descendant of native_type, so fail the cast.
// This is a very simple version of mp_obj_is_subclass_fast that could be improved.
return MP_OBJ_NULL;