Decref error in except clause
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Oct 2007 07:14:26 +0000 (00:14 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Oct 2007 07:14:26 +0000 (00:14 -0700)
Temporary variables must be set to zero or they might be XDECREF'ed later, generating very hard to track bugs.

Cython/Compiler/Nodes.py

index ba54027b8ce48251f1de05f07384498540b6748d..515ed39439d603f7c0cf1d26b14d8e3b008df3a7 100644 (file)
@@ -2589,7 +2589,7 @@ class ExceptClauseNode(Node):
         self.body.generate_execution_code(code)
         code.exc_vars = old_exc_vars
         for var in self.exc_vars:
-            code.putln("Py_DECREF(%s);" % var)
+            code.putln("Py_DECREF(%s); %s = 0;" % (var, var))
         code.put_goto(end_label)
         code.putln(
             "}")