summaryrefslogtreecommitdiff
path: root/py/objnamedtuple.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-06-21 15:37:35 +0200
committerDamien George <damien@micropython.org>2025-07-25 10:56:02 +1000
commit519cba4d050e0c0bf69039908ef255b421d8ce57 (patch)
tree14086969639eab518512236dd78982abc622bd41 /py/objnamedtuple.c
parent7493275918dbe7d787044e648bc8036062cf7b0d (diff)
py: Cast type names to qstr explicitly.
The name field of type objects is of type `uint16_t` for efficiency, but when the type is passed to `mp_printf` it must be cast explicitly to type `qstr`. These locations were found using an experimental gcc plugin for `mp_printf` error checking, cross-building for x64 windows on Linux. Signed-off-by: Jeff Epler <jepler@gmail.com>
Diffstat (limited to 'py/objnamedtuple.c')
-rw-r--r--py/objnamedtuple.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index f019604d5..e8447ee31 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -63,7 +63,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(namedtuple_asdict_obj, namedtuple_asdict);
static void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_namedtuple_t *o = MP_OBJ_TO_PTR(o_in);
- mp_printf(print, "%q", o->tuple.base.type->name);
+ mp_printf(print, "%q", (qstr)o->tuple.base.type->name);
const qstr *fields = ((mp_obj_namedtuple_type_t *)o->tuple.base.type)->fields;
mp_obj_attrtuple_print_helper(print, fields, &o->tuple);
}