summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-16 13:58:08 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-16 14:00:01 +0200
commit3cb766344ddd214c29d682929b78ae228b899c0b (patch)
tree594882b7d81b13f8f35d578d0e3231c99a71512e /py
parentf0dc0d50e3bfbdf77cdefd7a722f1f7884fa1a73 (diff)
objtype: Refactor dealing with native sub-objects for clarity.
Diffstat (limited to 'py')
-rw-r--r--py/objtype.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/py/objtype.c b/py/objtype.c
index b390e70d4..b3f6eb109 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -135,10 +135,13 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
// not type where we found a class method.
const mp_obj_type_t *org_type = (const mp_obj_type_t*)lookup->obj;
instance_convert_return_attr(NULL, org_type, elem->value, lookup->dest);
- } else if (lookup->obj != MP_OBJ_NULL && is_native_type(type) && type != &mp_type_object /* object is not a real type */) {
- instance_convert_return_attr(lookup->obj->subobj[0], type, elem->value, lookup->dest);
} else {
- instance_convert_return_attr(lookup->obj, type, elem->value, lookup->dest);
+ mp_obj_instance_t *obj = lookup->obj;
+ if (obj != MP_OBJ_NULL && is_native_type(type) && type != &mp_type_object /* object is not a real type */) {
+ // If we're dealing with native base class, then it applies to native sub-object
+ obj = obj->subobj[0];
+ }
+ instance_convert_return_attr(obj, type, elem->value, lookup->dest);
}
#if DEBUG_PRINT
printf("mp_obj_class_lookup: Returning: ");