summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-25 00:55:39 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-25 01:39:10 +0200
commit7f8b31345b6be789792b676a8975497648b19a5c (patch)
tree1551222afe9a721fb7899602918cc78c61631396
parentda5e269e51222767775eaac0c0253dbf477b45c1 (diff)
downloadmicropython-7f8b31345b6be789792b676a8975497648b19a5c.tar.gz
micropython-7f8b31345b6be789792b676a8975497648b19a5c.zip
rt_load_method(): Add missing qstr_str() when getting type name.
-rw-r--r--py/runtime.c3
-rw-r--r--tests/basics/types1.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 58c6620085..17a9e778d1 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1001,7 +1001,8 @@ void rt_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) {
// no attribute/method called attr
// following CPython, we give a more detailed error message for type objects
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 {
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)));
}
diff --git a/tests/basics/types1.py b/tests/basics/types1.py
index 850b31b08c..57b33b842b 100644
--- a/tests/basics/types1.py
+++ b/tests/basics/types1.py
@@ -26,3 +26,8 @@ print(type(()) == tuple)
print(type([]) == list)
print(type({None}) == set)
print(type({}) == dict)
+
+try:
+ bool.foo
+except AttributeError:
+ print("AttributeError")