objtype: Clarify comment why we call mp_load_method_maybe() for native sub-obj.

This commit is contained in:
Paul Sokolovsky 2015-03-17 02:07:00 +02:00
parent 49fe6dc89a
commit 1954d8021f
1 changed files with 3 additions and 2 deletions

View File

@ -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) {