From 1954d8021f9e9ac82ffea25b4fc647edfb19e773 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 17 Mar 2015 02:07:00 +0200 Subject: [PATCH] objtype: Clarify comment why we call mp_load_method_maybe() for native sub-obj. --- py/objtype.c | 5 +++-- 1 file 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) {