Dag, I was working on a fix for tiket #90
<http://trac.cython.org/cython_trac/ticket/90>, but your latest commit
forced me to rework my patch. Could you please review the attached
patch (you also have it in trac!!)?
All the tests pass with this patch, but perhaps I'm missing
something... Thanks in advance.
--
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
diff -r 57467649c34c Cython/Compiler/Optimize.py
--- a/Cython/Compiler/Optimize.py Wed Oct 15 12:10:09 2008 -0300
+++ b/Cython/Compiler/Optimize.py Wed Oct 15 13:05:13 2008 -0300
@@ -154,9 +154,12 @@ class FinalOptimizePhase(Visitor.CythonT
lhs = node.lhs
lhs.lhs_of_first_assignment = True
if isinstance(lhs, ExprNodes.NameNode) and lhs.entry.type.is_pyobject:
- # Have variable initialized to 0 rather than None
- lhs.entry.init_to_none = False
lhs.entry.init = 0
+ if lhs.entry.scope.is_module_scope:
+ lhs.entry.init_to_none = True
+ lhs.lhs_of_first_assignment = False
+ else:
+ lhs.entry.init_to_none = False
return node
def visit_SimpleCallNode(self, node):
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev