@@ -1060,7 +1060,8 @@ void mp_convert_member_lookup(mp_obj_t self, const mp_obj_type_t *type, mp_obj_t
1060
1060
dest [1 ] = self ;
1061
1061
}
1062
1062
#if MICROPY_PY_BUILTINS_PROPERTY
1063
- } else if (MP_OBJ_IS_TYPE (member , & mp_type_property ) && mp_obj_is_native_type (type )) {
1063
+ // If self is MP_OBJ_NULL, we looking at the class itself, not an instance.
1064
+ } else if (MP_OBJ_IS_TYPE (member , & mp_type_property ) && mp_obj_is_native_type (type ) && self != MP_OBJ_NULL ) {
1064
1065
// object member is a property; delegate the load to the property
1065
1066
// Note: This is an optimisation for code size and execution time.
1066
1067
// The proper way to do it is have the functionality just below
@@ -1161,7 +1162,8 @@ void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t value) {
1161
1162
assert (type -> locals_dict -> base .type == & mp_type_dict ); // Micro Python restriction, for now
1162
1163
mp_map_t * locals_map = & type -> locals_dict -> map ;
1163
1164
mp_map_elem_t * elem = mp_map_lookup (locals_map , MP_OBJ_NEW_QSTR (attr ), MP_MAP_LOOKUP );
1164
- if (elem != NULL && MP_OBJ_IS_TYPE (elem -> value , & mp_type_property )) {
1165
+ // If base is MP_OBJ_NULL, we looking at the class itself, not an instance.
1166
+ if (elem != NULL && MP_OBJ_IS_TYPE (elem -> value , & mp_type_property ) && base != MP_OBJ_NULL ) {
1165
1167
// attribute exists and is a property; delegate the store/delete
1166
1168
// Note: This is an optimisation for code size and execution time.
1167
1169
// The proper way to do it is have the functionality just below in
0 commit comments