summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-05-25 10:59:40 +1000
committerDamien George <damien.p.george@gmail.com>2018-05-25 10:59:40 +1000
commitdfeaea144168c3ec3b4ec513cfb201ce93f99f5e (patch)
tree992f2101b5782d0423db9023a8c56fac413463e6
parent15ddc2043687942c68d9ab54176fd837f44d3083 (diff)
py/objtype: Remove TODO comment about needing to check for property.
Instance members are always treated as values, even if they are properties. A test is added to show this is the case.
-rw-r--r--py/objtype.c1
-rw-r--r--tests/basics/builtin_property.py6
2 files changed, 6 insertions, 1 deletions
diff --git a/py/objtype.c b/py/objtype.c
index 7df349ce9..2ec27c762 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -562,7 +562,6 @@ STATIC void mp_obj_instance_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *des
mp_map_elem_t *elem = mp_map_lookup(&self->members, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
if (elem != NULL) {
// object member, always treated as a value
- // TODO should we check for properties?
dest[0] = elem->value;
return;
}
diff --git a/tests/basics/builtin_property.py b/tests/basics/builtin_property.py
index 89c3d4936..4b08ee9d3 100644
--- a/tests/basics/builtin_property.py
+++ b/tests/basics/builtin_property.py
@@ -105,3 +105,9 @@ class E:
# not tested for because the other keyword arguments are not accepted
# q = property(fget=lambda self: 21, doc="Half the truth.")
print(E().p)
+
+# a property as an instance member should not be delegated to
+class F:
+ def __init__(self):
+ self.prop_member = property()
+print(type(F().prop_member))