Skip to content

Commit 94792dd

Browse files
author
Daniel Campora
committed
py: In attrtuple use the correct length value and index for 'fields'.
1 parent 5225e29 commit 94792dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

py/objattrtuple.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ STATIC
3434
#endif
3535
void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields, mp_obj_tuple_t *o) {
3636
mp_print_str(print, "(");
37-
for (mp_uint_t i = 0; i < o->len; i++) {
37+
for (mp_uint_t i = 0; i < (o->len - 1); i++) {
3838
if (i > 0) {
3939
mp_print_str(print, ", ");
4040
}
@@ -51,7 +51,7 @@ void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields,
5151
STATIC void mp_obj_attrtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
5252
(void)kind;
5353
mp_obj_tuple_t *o = o_in;
54-
const qstr *fields = (const qstr*)o->items[o->len];
54+
const qstr *fields = (const qstr*)o->items[o->len - 1];
5555
mp_obj_attrtuple_print_helper(print, fields, o);
5656
}
5757

0 commit comments

Comments
 (0)