mp_obj_get_array: Work with namedtuple, attrtuple.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2021-06-26 20:00:56 -05:00
parent f380a91e7c
commit 33482e0831

View File

@ -444,7 +444,7 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
// note: returned value in *items may point to the interior of a GC block // note: returned value in *items may point to the interior of a GC block
void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items) { void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items) {
if (mp_obj_is_type(o, &mp_type_tuple)) { if (mp_obj_is_tuple_compatible(o)) {
mp_obj_tuple_get(o, len, items); mp_obj_tuple_get(o, len, items);
} else if (mp_obj_is_type(o, &mp_type_list)) { } else if (mp_obj_is_type(o, &mp_type_list)) {
mp_obj_list_get(o, len, items); mp_obj_list_get(o, len, items);