some cleanup, fix temp handling in 'if' conditions
authorStefan Behnel <scoder@users.berlios.de>
Wed, 3 Dec 2008 20:57:18 +0000 (21:57 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 3 Dec 2008 20:57:18 +0000 (21:57 +0100)
Cython/Compiler/Nodes.py

index 41f304c43db6262c7fd3fb26277a33bf4e37c0b9..eab1e5b40ac6c83015332a76568038e3d223ca39 100644 (file)
@@ -3382,15 +3382,10 @@ class RaiseStatNode(StatNode):
         else:
             code.putln(
                 "__Pyx_ReRaise();")
-        if self.exc_type:
-            self.exc_type.generate_disposal_code(code)
-            self.exc_type.free_temps(code)
-        if self.exc_value:
-            self.exc_value.generate_disposal_code(code)
-            self.exc_value.free_temps(code)
-        if self.exc_tb:
-            self.exc_tb.generate_disposal_code(code)
-            self.exc_tb.free_temps(code)
+        for obj in (self.exc_type, self.exc_value, self.exc_tb):
+            if obj:
+                obj.generate_disposal_code(code)
+                obj.free_temps(code)
         code.putln(
             code.error_goto(self.pos))
 
@@ -3548,6 +3543,8 @@ class IfClauseNode(Node):
         code.putln(
             "if (%s) {" %
                 self.condition.result())
+        self.condition.generate_disposal_code(code)
+        self.condition.free_temps(code)
         self.body.generate_execution_code(code)
         #code.putln(
         #      "goto %s;" %