Since Dag's refnanny was integrated in cython-devel,
test/run/tryfinally.pyx was failing because of reference count errors.

The patch below is the only way I can imagine to fix such problem. I
expect the patch could be controversial...


diff -r 3b522098d133 Cython/Compiler/Nodes.py
--- a/Cython/Compiler/Nodes.py  Sun Feb 08 09:25:28 2009 +0100
+++ b/Cython/Compiler/Nodes.py  Mon Feb 09 18:22:21 2009 -0200
@@ -1054,6 +1054,8 @@
         code.put_var_declarations(lenv.var_entries)
         init = ""
         if not self.return_type.is_void:
+            if self.return_type.is_pyobject:
+                init = " = NULL"
             code.putln(
                 "%s%s;" %
                     (self.return_type.declaration_code(
@@ -3371,6 +3373,9 @@
         if self.value:
             self.value.generate_evaluation_code(code)
             self.value.make_owned_reference(code)
+            if self.return_type.is_pyobject:
+                code.put_xdecref(Naming.retval_cname,
+                                 self.return_type)
             code.putln(
                 "%s = %s;" % (
                     Naming.retval_cname,

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to