diff --git a/py/objtuple.c b/py/objtuple.c index e7e24ab188..c547da9406 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -104,10 +104,8 @@ 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 bool tuple_cmp_helper(mp_uint_t op, mp_obj_t self_in, mp_obj_t another_in) { - mp_obj_type_t *self_type = mp_obj_get_type(self_in); - if (self_type->getiter != mp_obj_tuple_getiter) { - mp_raise_TypeError(""); - } + // type check is done on getiter method to allow tuple, namedtuple, attrtuple + mp_check_self(mp_obj_get_type(self_in)->getiter == mp_obj_tuple_getiter); 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) {