summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-07-16 19:36:40 -0400
committerDan Halbert <halbert@halwitz.org>2018-07-16 19:36:40 -0400
commit2809b4f9dd08dd1e83e87f1f4088ba22f3f66cd2 (patch)
treee87027c60d5de0811f6213d087c677bc59295bd0 /py/runtime.c
parente2e01efa84d2ed46d004edf48076e4701accc176 (diff)
parent617351aebc59e27a5f9a8a3b38032637a49f5432 (diff)
Merge branch 'master' into micropython-25ae98f-merge
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 4ba4760e6..c76cb2e14 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1049,7 +1049,8 @@ void mp_convert_member_lookup(mp_obj_t self, const mp_obj_type_t *type, mp_obj_t
dest[1] = self;
}
#if MICROPY_PY_BUILTINS_PROPERTY
- } else if (MP_OBJ_IS_TYPE(member, &mp_type_property) && mp_obj_is_native_type(type)) {
+ // If self is MP_OBJ_NULL, we looking at the class itself, not an instance.
+ } else if (MP_OBJ_IS_TYPE(member, &mp_type_property) && mp_obj_is_native_type(type) && self != MP_OBJ_NULL) {
// object member is a property; delegate the load to the property
// Note: This is an optimisation for code size and execution time.
// The proper way to do it is have the functionality just below
@@ -1166,7 +1167,8 @@ void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t value) {
assert(type->locals_dict->base.type == &mp_type_dict); // Micro Python restriction, for now
mp_map_t *locals_map = &type->locals_dict->map;
mp_map_elem_t *elem = mp_map_lookup(locals_map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
- if (elem != NULL && MP_OBJ_IS_TYPE(elem->value, &mp_type_property)) {
+ // If base is MP_OBJ_NULL, we looking at the class itself, not an instance.
+ if (elem != NULL && MP_OBJ_IS_TYPE(elem->value, &mp_type_property) && base != MP_OBJ_NULL) {
// attribute exists and is a property; delegate the store/delete
// Note: This is an optimisation for code size and execution time.
// The proper way to do it is have the functionality just below in