py/objtype: Inherit protocol vtable from base class only if it exists.
This commit is contained in:
parent
efee577318
commit
c7fba524cb
@ -918,7 +918,9 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
|
|||||||
// abstract base class which would translate C-level protocol to
|
// abstract base class which would translate C-level protocol to
|
||||||
// Python method calls, and any subclass inheriting from it will
|
// Python method calls, and any subclass inheriting from it will
|
||||||
// support this feature.
|
// support this feature.
|
||||||
o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
|
if (len > 0) {
|
||||||
|
o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
|
||||||
|
}
|
||||||
o->bases_tuple = MP_OBJ_TO_PTR(bases_tuple);
|
o->bases_tuple = MP_OBJ_TO_PTR(bases_tuple);
|
||||||
o->locals_dict = MP_OBJ_TO_PTR(locals_dict);
|
o->locals_dict = MP_OBJ_TO_PTR(locals_dict);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user