@@ -567,6 +567,7 @@ STATIC void mp_obj_instance_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *des
567
567
mp_obj_class_lookup (& lookup , self -> base .type );
568
568
mp_obj_t member = dest [0 ];
569
569
if (member != MP_OBJ_NULL ) {
570
+ // changes here may may require changes to super_attr, below
570
571
#if MICROPY_PY_BUILTINS_PROPERTY
571
572
if (MP_OBJ_IS_TYPE (member , & mp_type_property )) {
572
573
// object member is a property; delegate the load to the property
@@ -1112,14 +1113,37 @@ STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
1112
1113
assert (MP_OBJ_IS_TYPE (items [i ], & mp_type_type ));
1113
1114
mp_obj_class_lookup (& lookup , (mp_obj_type_t * )MP_OBJ_TO_PTR (items [i ]));
1114
1115
if (dest [0 ] != MP_OBJ_NULL ) {
1115
- return ;
1116
+ break ;
1116
1117
}
1117
1118
}
1118
1119
} else {
1119
1120
mp_obj_class_lookup (& lookup , type -> parent );
1120
- if (dest [0 ] != MP_OBJ_NULL ) {
1121
- return ;
1121
+ }
1122
+
1123
+ if (dest [0 ] != MP_OBJ_NULL ) {
1124
+ mp_obj_t member = dest [0 ];
1125
+ // changes to mp_obj_instance_load_attr may require changes
1126
+ // here...
1127
+ #if MICROPY_PY_BUILTINS_PROPERTY
1128
+ if (MP_OBJ_IS_TYPE (member , & mp_type_property )) {
1129
+ const mp_obj_t * proxy = mp_obj_property_get (member );
1130
+ if (proxy [0 ] == mp_const_none ) {
1131
+ mp_raise_AttributeError ("unreadable attribute" );
1132
+ } else {
1133
+ dest [0 ] = mp_call_function_n_kw (proxy [0 ], 1 , 0 , & self_in );
1134
+ }
1135
+ }
1136
+ #endif
1137
+ #if MICROPY_PY_DESCRIPTORS
1138
+ mp_obj_t attr_get_method [4 ];
1139
+ mp_load_method_maybe (member , MP_QSTR___get__ , attr_get_method );
1140
+ if (attr_get_method [0 ] != MP_OBJ_NULL ) {
1141
+ attr_get_method [2 ] = self_in ;
1142
+ attr_get_method [3 ] = MP_OBJ_FROM_PTR (mp_obj_get_type (self_in ));
1143
+ dest [0 ] = mp_call_method_n_kw (2 , 0 , attr_get_method );
1122
1144
}
1145
+ #endif
1146
+ return ;
1123
1147
}
1124
1148
1125
1149
mp_obj_class_lookup (& lookup , & mp_type_object );
0 commit comments