Skip to content

Commit c7fba52

Browse files
committed
py/objtype: Inherit protocol vtable from base class only if it exists.
1 parent efee577 commit c7fba52

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

py/objtype.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,9 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
918918
// abstract base class which would translate C-level protocol to
919919
// Python method calls, and any subclass inheriting from it will
920920
// support this feature.
921-
o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
921+
if (len > 0) {
922+
o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
923+
}
922924
o->bases_tuple = MP_OBJ_TO_PTR(bases_tuple);
923925
o->locals_dict = MP_OBJ_TO_PTR(locals_dict);
924926

0 commit comments

Comments
 (0)