From b357710a635e7f9aef814118377c66c278a11808 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 12 Jan 2008 11:32:19 +0100 Subject: [PATCH] only generate tp_clear/traverse functions if type supports GC --- Cython/Compiler/ModuleNode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 758546da..5c78abda 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -566,8 +566,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): self.generate_exttype_vtable(scope, code) self.generate_new_function(scope, code) self.generate_dealloc_function(scope, code) - self.generate_traverse_function(scope, code) - self.generate_clear_function(scope, code) + if scope.needs_gc(): + self.generate_traverse_function(scope, code) + self.generate_clear_function(scope, code) if scope.defines_any(["__getitem__"]): self.generate_getitem_int_function(scope, code) if scope.defines_any(["__setitem__", "__delitem__"]): -- 2.26.2