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.
This commit is contained in:
parent
15ddc20436
commit
dfeaea1441
|
@ -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);
|
mp_map_elem_t *elem = mp_map_lookup(&self->members, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
|
||||||
if (elem != NULL) {
|
if (elem != NULL) {
|
||||||
// object member, always treated as a value
|
// object member, always treated as a value
|
||||||
// TODO should we check for properties?
|
|
||||||
dest[0] = elem->value;
|
dest[0] = elem->value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,3 +105,9 @@ class E:
|
||||||
# not tested for because the other keyword arguments are not accepted
|
# not tested for because the other keyword arguments are not accepted
|
||||||
# q = property(fget=lambda self: 21, doc="Half the truth.")
|
# q = property(fget=lambda self: 21, doc="Half the truth.")
|
||||||
print(E().p)
|
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))
|
||||||
|
|
Loading…
Reference in New Issue