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