summaryrefslogtreecommitdiffstatshomepage
path: root/py/objattrtuple.c
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-04-28 23:45:15 +0200
committerDaniel Campora <daniel@wipy.io>2015-04-29 00:04:00 +0200
commit94792dd88f72cc4f754f40f63960d8932cea0365 (patch)
treee07f06433983fa42d0fdb90e316b9cfb147a1c1e /py/objattrtuple.c
parent5225e29ce706ca7601aeeaa286c84ee0e6fa597b (diff)
downloadmicropython-94792dd88f72cc4f754f40f63960d8932cea0365.tar.gz
micropython-94792dd88f72cc4f754f40f63960d8932cea0365.zip
py: In attrtuple use the correct length value and index for 'fields'.
Diffstat (limited to 'py/objattrtuple.c')
-rw-r--r--py/objattrtuple.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objattrtuple.c b/py/objattrtuple.c
index 223c4c5810..b3fa314489 100644
--- a/py/objattrtuple.c
+++ b/py/objattrtuple.c
@@ -34,7 +34,7 @@ STATIC
#endif
void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields, mp_obj_tuple_t *o) {
mp_print_str(print, "(");
- for (mp_uint_t i = 0; i < o->len; i++) {
+ for (mp_uint_t i = 0; i < (o->len - 1); i++) {
if (i > 0) {
mp_print_str(print, ", ");
}
@@ -51,7 +51,7 @@ void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields,
STATIC void mp_obj_attrtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_tuple_t *o = o_in;
- const qstr *fields = (const qstr*)o->items[o->len];
+ const qstr *fields = (const qstr*)o->items[o->len - 1];
mp_obj_attrtuple_print_helper(print, fields, o);
}