Commit 1954d802 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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

parent 49fe6dc8
...@@ -152,8 +152,9 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_ ...@@ -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 // Previous code block takes care about attributes defined in .locals_dict,
// in locals_dict, and would be handled by above. // 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 */) { 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); mp_load_method_maybe(lookup->obj->subobj[0], lookup->attr, lookup->dest);
if (lookup->dest[0] != MP_OBJ_NULL) { if (lookup->dest[0] != MP_OBJ_NULL) {
......
Supports Markdown
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