Skip to content

Commit f36c774

Browse files
committed
revert to initialize vtable always
1 parent 232db96 commit f36c774

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

mypyc/codegen/emitclass.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -563,15 +563,14 @@ def generate_setup_for_class(
563563
emitter.emit_line("if (self == NULL)")
564564
emitter.emit_line(" return NULL;")
565565

566-
if not cl.is_final_class:
567-
if shadow_vtable_name:
568-
emitter.emit_line(f"if (type != {emitter.type_struct_name(cl)}) {{")
569-
emitter.emit_line(f"self->vtable = {shadow_vtable_name};")
570-
emitter.emit_line("} else {")
571-
emitter.emit_line(f"self->vtable = {vtable_name};")
572-
emitter.emit_line("}")
573-
else:
574-
emitter.emit_line(f"self->vtable = {vtable_name};")
566+
if shadow_vtable_name:
567+
emitter.emit_line(f"if (type != {emitter.type_struct_name(cl)}) {{")
568+
emitter.emit_line(f"self->vtable = {shadow_vtable_name};")
569+
emitter.emit_line("} else {")
570+
emitter.emit_line(f"self->vtable = {vtable_name};")
571+
emitter.emit_line("}")
572+
else:
573+
emitter.emit_line(f"self->vtable = {vtable_name};")
575574

576575
for i in range(0, len(cl.bitmap_attrs), BITMAP_BITS):
577576
field = emitter.bitmap_field(i)

0 commit comments

Comments
 (0)