summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/objstr.c b/py/objstr.c
index 2331004a5b..1e71617bda 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -2065,9 +2065,10 @@ STATIC void bad_implicit_conversion(mp_obj_t self_in) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
mp_raise_TypeError("can't convert to str implicitly");
} else {
+ const qstr src_name = mp_obj_get_type(self_in)->name;
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
- "can't convert '%s' object to str implicitly",
- mp_obj_get_type_str(self_in)));
+ "can't convert '%q' object to %q implicitly",
+ src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str));
}
}