diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-18 17:52:41 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-18 17:52:41 +0000 |
commit | f49ba1bd9cdbe2dbb9bb093bf0ac5cde506142c0 (patch) | |
tree | 77208e8c58c025003cf7368cba210114e89a9cd8 /py/runtime.c | |
parent | 1d6fc94c166f459cf8a6667661be0985fab7d446 (diff) | |
download | micropython-f49ba1bd9cdbe2dbb9bb093bf0ac5cde506142c0.tar.gz micropython-f49ba1bd9cdbe2dbb9bb093bf0ac5cde506142c0.zip |
Improve method lookup in mp_obj_class_lookup.
Now searches both locals_dict and methods. Partly addresses Issue #145.
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c index b9d6c841f4..480da41297 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -820,8 +820,8 @@ void rt_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest) { if (attr == MP_QSTR___next__ && type->iternext != NULL) { dest[0] = (mp_obj_t)&mp_builtin_next_obj; dest[1] = base; - } else { - // generic method lookup + } else if (type->load_attr == NULL) { + // generic method lookup if type didn't provide a specific one // this is a lookup in the object (ie not class or type) const mp_method_t *meth = type->methods; if (meth != NULL) { |