Merge pull request #2053 from jepler/namedtuple-tuple_get
py: mp_obj_tuple_get: accept any item which can use tuple_getiter
This commit is contained in:
commit
eb1a158c1b
@ -251,7 +251,8 @@ mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items) {
|
||||
}
|
||||
|
||||
void mp_obj_tuple_get(mp_obj_t self_in, size_t *len, mp_obj_t **items) {
|
||||
assert(MP_OBJ_IS_TYPE(self_in, &mp_type_tuple));
|
||||
// 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_tuple_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
*len = self->len;
|
||||
*items = &self->items[0];
|
||||
|
Loading…
Reference in New Issue
Block a user