Skip to content

Commit 24f5ce3

Browse files
committed
Free type structs for non generated classes
Free the type structs associated with all classes in the case of an error, regardless of whether those classes are generated.
1 parent 2f24fe6 commit 24f5ce3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypyc/codegen/emitmodule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,9 @@ def generate_module_def(self, emitter: Emitter, module_name: str, module: Module
902902
# HACK: Manually instantiate generated classes here
903903
type_structs = [] # type: List[str]
904904
for cl in module.classes:
905+
type_struct = emitter.type_struct_name(cl)
906+
type_structs.append(type_struct)
905907
if cl.is_generated:
906-
type_struct = emitter.type_struct_name(cl)
907-
type_structs.append(type_struct)
908908
emitter.emit_lines(
909909
'{t} = (PyTypeObject *)CPyType_FromTemplate('
910910
'(PyObject *){t}_template, NULL, modname);'

0 commit comments

Comments
 (0)