only generate tp_clear/traverse functions if type supports GC
authorStefan Behnel <scoder@users.berlios.de>
Sat, 12 Jan 2008 10:32:19 +0000 (11:32 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 12 Jan 2008 10:32:19 +0000 (11:32 +0100)
Cython/Compiler/ModuleNode.py

index 758546daad56c5206cb16823a78c0d98a47ed0c0..5c78abda441ef8c103c57ab8a94f78b1df89c136 100644 (file)
@@ -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__"]):