objtype: Clarify comment for mp_obj_class_lookup().
This commit is contained in:
parent
66c11ec581
commit
2b67a40fdb
16
py/objtype.c
16
py/objtype.c
|
@ -90,13 +90,15 @@ STATIC int instance_count_native_bases(const mp_obj_type_t *type, const mp_obj_t
|
|||
// http://python-history.blogspot.com/2010/06/method-resolution-order.html
|
||||
// https://www.python.org/download/releases/2.3/mro/
|
||||
//
|
||||
// will return MP_OBJ_NULL if not found
|
||||
// will return MP_OBJ_SENTINEL if special method was found in a native type base
|
||||
// via slot id (meth_offset). As there can be only one native base, it's known that it
|
||||
// applies to instance->subobj[0]. In most cases, we also don't need to know which type
|
||||
// it was - because instance->subobj[0] is of that type. The only exception is when
|
||||
// object is not yet constructed, then we need to know base native type to construct
|
||||
// instance->subobj[0]. This case is handled via instance_count_native_bases() though.
|
||||
// will keep lookup->dest[0]'s value (should be MP_OBJ_NULL on invocation) if attribute
|
||||
// is not found
|
||||
// will set lookup->dest[0] to MP_OBJ_SENTINEL if special method was found in a native
|
||||
// type base via slot id (as specified by lookup->meth_offset). As there can be only one
|
||||
// native base, it's known that it applies to instance->subobj[0]. In most cases, we also
|
||||
// don't need to know which type it was - because instance->subobj[0] is of that type.
|
||||
// The only exception is when object is not yet constructed, then we need to know base
|
||||
// native type to construct its instance->subobj[0] from. But this case is handled via
|
||||
// instance_count_native_bases(), which returns a native base which it saw.
|
||||
struct class_lookup_data {
|
||||
mp_obj_instance_t *obj;
|
||||
qstr attr;
|
||||
|
|
Loading…
Reference in New Issue