py: Add %q format support to mp_[v]printf, and use it.
diff --git a/py/bc.c b/py/bc.c
index 613cce7..a8f2566 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -61,8 +61,8 @@
"function takes %d positional arguments but %d were given", expected, given));
#elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
- "%s() takes %d positional arguments but %d were given",
- qstr_str(mp_obj_fun_get_name(f)), expected, given));
+ "%q() takes %d positional arguments but %d were given",
+ mp_obj_fun_get_name(f), expected, given));
#endif
}
@@ -166,7 +166,7 @@
if (wanted_arg_name == arg_names[j]) {
if (code_state->state[n_state - 1 - j] != MP_OBJ_NULL) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
- "function got multiple values for argument '%s'", qstr_str(MP_OBJ_QSTR_VALUE(wanted_arg_name))));
+ "function got multiple values for argument '%q'", MP_OBJ_QSTR_VALUE(wanted_arg_name)));
}
code_state->state[n_state - 1 - j] = kwargs[2 * i + 1];
goto continue2;
@@ -215,7 +215,7 @@
code_state->state[n_state - 1 - self->n_pos_args - i] = elem->value;
} else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
- "function missing required keyword argument '%s'", qstr_str(MP_OBJ_QSTR_VALUE(arg_names[self->n_pos_args + i]))));
+ "function missing required keyword argument '%q'", MP_OBJ_QSTR_VALUE(arg_names[self->n_pos_args + i])));
}
}
}