diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-26 22:35:10 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-26 22:35:10 +0000 |
commit | c3f1126ee8e0cb23b9778c6b544556ba8ba340ae (patch) | |
tree | 65701b575de6be8886ab2bc79593766d472cd0d8 /py/runtime.c | |
parent | 6022d9d478b2b9cca9210de7c591a7788914ce97 (diff) | |
download | micropython-c3f1126ee8e0cb23b9778c6b544556ba8ba340ae.tar.gz micropython-c3f1126ee8e0cb23b9778c6b544556ba8ba340ae.zip |
py: Fix logic bugs in object attribute/method extraction.
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c index 1f4a524b70..6590e8e0d0 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -859,10 +859,13 @@ STATIC void rt_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest) { // return a bound method, with self being the type of this object dest[0] = ((mp_obj_static_class_method_t*)elem->value)->fun; dest[1] = mp_obj_get_type(base); - } else { + } else if (mp_obj_is_callable(elem->value)) { // return a bound method, with self being this object - dest[0] = (mp_obj_t)elem->value; + dest[0] = elem->value; dest[1] = base; + } else { + // class member is a value, so just return that value + dest[0] = elem->value; } } } |