Commit 7f8b3134 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

rt_load_method(): Add missing qstr_str() when getting type name.

parent da5e269e
...@@ -1001,7 +1001,8 @@ void rt_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) { ...@@ -1001,7 +1001,8 @@ void rt_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) {
// no attribute/method called attr // no attribute/method called attr
// following CPython, we give a more detailed error message for type objects // following CPython, we give a more detailed error message for type objects
if (MP_OBJ_IS_TYPE(base, &mp_type_type)) { if (MP_OBJ_IS_TYPE(base, &mp_type_type)) {
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, "type object '%s' has no attribute '%s'", ((mp_obj_type_t*)base)->name, qstr_str(attr))); nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_AttributeError,
"type object '%s' has no attribute '%s'", qstr_str(((mp_obj_type_t*)base)->name), qstr_str(attr)));
} else { } else {
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, "'%s' object has no attribute '%s'", mp_obj_get_type_str(base), qstr_str(attr))); nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_AttributeError, "'%s' object has no attribute '%s'", mp_obj_get_type_str(base), qstr_str(attr)));
} }
......
...@@ -26,3 +26,8 @@ print(type(()) == tuple) ...@@ -26,3 +26,8 @@ print(type(()) == tuple)
print(type([]) == list) print(type([]) == list)
print(type({None}) == set) print(type({None}) == set)
print(type({}) == dict) print(type({}) == dict)
try:
bool.foo
except AttributeError:
print("AttributeError")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment