summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-15 11:34:50 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-15 11:34:50 +0000
commita71c83a1d1aeca1d81d7c673929f8e836dec131e (patch)
tree5c49441e19c3feffbc792eec7ecfbc3ca3036830 /py/obj.c
parent8ac72b9d000ecc48a2d558bdb7c73c7f98d4be62 (diff)
downloadmicropython-a71c83a1d1aeca1d81d7c673929f8e836dec131e.tar.gz
micropython-a71c83a1d1aeca1d81d7c673929f8e836dec131e.zip
Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/obj.c b/py/obj.c
index 4e0184a5f0..86c0edc15b 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -26,7 +26,7 @@ mp_obj_type_t *mp_obj_get_type(mp_obj_t o_in) {
}
const char *mp_obj_get_type_str(mp_obj_t o_in) {
- return mp_obj_get_type(o_in)->name;
+ return qstr_str(mp_obj_get_type(o_in)->name);
}
void printf_wrapper(void *env, const char *fmt, ...) {
@@ -41,7 +41,7 @@ void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *e
if (type->print != NULL) {
type->print(print, env, o_in, kind);
} else {
- print(env, "<%s>", type->name);
+ print(env, "<%s>", qstr_str(type->name));
}
}
@@ -226,11 +226,11 @@ uint mp_get_index(const mp_obj_type_t *type, machine_uint_t len, mp_obj_t index)
i += len;
}
if (i < 0 || i >= len) {
- nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_IndexError, "%s index out of range", type->name));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_IndexError, "%s index out of range", qstr_str(type->name)));
}
return i;
} else {
- nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "%s indices must be integers, not %s", type->name, mp_obj_get_type_str(index)));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "%s indices must be integers, not %s", qstr_str(type->name), mp_obj_get_type_str(index)));
}
}