QUERY · ISSUE
mp_obj_class_lookup error
After I rebuilt, there was a problem running the example. I don't know why
assertion "mp_obj_is_dict_or_ordereddict(MP_OBJ_FROM_PTR(type->locals_dict))" failed: file "/home/hxm/Desktop/lv_micropython/py/objtype.c", line 156, function: mp_obj_class_lookup
CANDIDATE · ISSUE
Q: Recommended way to look an object method taking into account base classes, C-defined methods, without side effects
So, what I'd like to do is:
- Get a method in an object (not interested in data member by the same name).
- Should consider both ->methods array and dict of dynamic type.
- If method not found, no exception throwing, etc.
Grepping headers by "method" I found rt_load_method(), which seemed cover 1&2, but throws exception on not found, so I proceeded to factor out it into non-throwing function.
But looking at objtype.c:class_make_new(), it uses mp_obj_class_lookup(), but that definitely doesn't consider ->methods.
So, what's the recommended way?