From: Craig Citro Date: Sat, 17 Jul 2010 07:16:50 +0000 (-0700) Subject: Fix bug in type analysis for ComprehensionNodes. X-Git-Tag: 0.13.beta0~2^2~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e31d6a8635b2f1d0493fa6185354ece654cd4b65;p=cython.git Fix bug in type analysis for ComprehensionNodes. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 035f97e6..09c925f1 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3988,6 +3988,9 @@ class ComprehensionNode(ScopedExprNode): if not self.has_local_scope: self.loop.analyse_expressions(env) + def analyse_expressions(self, env): + self.analyse_types(env) + def analyse_scoped_expressions(self, env): if self.has_local_scope: self.loop.analyse_expressions(env) diff --git a/tests/run/list_comprehension.pyx b/tests/run/list_comprehension.pyx new file mode 100644 index 00000000..2360a713 --- /dev/null +++ b/tests/run/list_comprehension.pyx @@ -0,0 +1,8 @@ + +def foo(): + """ + >>> foo() + [[], [-1], [-1, 0], [-1, 0, 1]] + """ + result = [[a-1 for a in range(b)] for b in range(4)] + return result