Skip to content

Commit 0ec6bd4

Browse files
committed
py: Fix printing of type name.
1 parent 5e34909 commit 0ec6bd4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

py/objexcept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ STATIC mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, uint n_args, uint n_
4848
mp_obj_type_t *type = type_in;
4949

5050
if (n_kw != 0) {
51-
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "%s does not take keyword arguments", type->name));
51+
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "%s does not take keyword arguments", mp_obj_get_type_str(type_in)));
5252
}
5353

5454
mp_obj_exception_t *o = m_new_obj_var(mp_obj_exception_t, mp_obj_t, n_args);

py/runtime.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ mp_obj_t rt_unary_op(int op, mp_obj_t arg) {
474474
}
475475
}
476476
// TODO specify in error message what the operator is
477-
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "bad operand type for unary operator: '%s'", type->name));
477+
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "bad operand type for unary operator: '%s'", mp_obj_get_type_str(arg)));
478478
}
479479
}
480480

@@ -721,7 +721,7 @@ mp_obj_t rt_call_function_n_kw(mp_obj_t fun_in, uint n_args, uint n_kw, const mp
721721
if (type->call != NULL) {
722722
return type->call(fun_in, n_args, n_kw, args);
723723
} else {
724-
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not callable", type->name));
724+
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not callable", mp_obj_get_type_str(fun_in)));
725725
}
726726
}
727727

@@ -927,7 +927,7 @@ mp_obj_t rt_getiter(mp_obj_t o_in) {
927927
return mp_obj_new_getitem_iter(dest);
928928
} else {
929929
// object not iterable
930-
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not iterable", type->name));
930+
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not iterable", mp_obj_get_type_str(o_in)));
931931
}
932932
}
933933
}
@@ -937,7 +937,7 @@ mp_obj_t rt_iternext(mp_obj_t o_in) {
937937
if (type->iternext != NULL) {
938938
return type->iternext(o_in);
939939
} else {
940-
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not an iterator", type->name));
940+
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not an iterator", mp_obj_get_type_str(o_in)));
941941
}
942942
}
943943

0 commit comments

Comments
 (0)