summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-17 02:07:00 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-17 02:08:08 +0200
commit1954d8021f9e9ac82ffea25b4fc647edfb19e773 (patch)
tree4833efa741c37947924e70b2e4f49c6ef7ae2381
parent49fe6dc89a45a5791cfa8dad86f25469749f2312 (diff)
downloadmicropython-1954d8021f9e9ac82ffea25b4fc647edfb19e773.tar.gz
micropython-1954d8021f9e9ac82ffea25b4fc647edfb19e773.zip
objtype: Clarify comment why we call mp_load_method_maybe() for native sub-obj.
-rw-r--r--py/objtype.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/objtype.c b/py/objtype.c
index b3f6eb1095..61395ac034 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -152,8 +152,9 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
}
}
- // Try this for completeness, but all native methods should be statically defined
- // in locals_dict, and would be handled by above.
+ // Previous code block takes care about attributes defined in .locals_dict,
+ // but some attributes of native types may be handled using .load_attr method,
+ // so make sure we try to lookup those too.
if (lookup->obj != MP_OBJ_NULL && !lookup->is_type && is_native_type(type) && type != &mp_type_object /* object is not a real type */) {
mp_load_method_maybe(lookup->obj->subobj[0], lookup->attr, lookup->dest);
if (lookup->dest[0] != MP_OBJ_NULL) {