fix usage of new manage_ref keyword for temp handles
authorStefan Behnel <scoder@users.berlios.de>
Thu, 27 Nov 2008 13:28:53 +0000 (14:28 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 27 Nov 2008 13:28:53 +0000 (14:28 +0100)
Cython/Compiler/UtilNodes.py

index 7fcf6fda27745fc4633bc9384a3e23bd5b91a090..58592117726454683a89e23f8b4cbe1b248ab040 100644 (file)
@@ -79,7 +79,9 @@ class TempsBlockNode(Node):
 
     def generate_execution_code(self, code):
         for handle in self.temps:
-            handle.temp = code.funcstate.allocate_temp(handle.type, manage_ref=True)
+            managed = handle.needs_cleanup or not handle.type.is_pyobject
+            handle.temp = code.funcstate.allocate_temp(
+                handle.type, manage_ref=managed)
         self.body.generate_execution_code(code)
         for handle in self.temps:
             if handle.needs_cleanup: