make auto_cpdef play nicely with closure functions
authorStefan Behnel <scoder@users.berlios.de>
Fri, 15 Apr 2011 13:56:49 +0000 (15:56 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 15 Apr 2011 13:56:49 +0000 (15:56 +0200)
Cython/Compiler/Main.py
Cython/Compiler/ParseTreeTransforms.py
tests/bugs.txt

index 993d8d9985a612896c18d817069deba72598ffe3..6b5deaee2c6a37d2d1fc1d8d4e977b83ad689655 100644 (file)
@@ -135,8 +135,8 @@ class Context(object):
             PostParse(self),
             _specific_post_parse,
             InterpretCompilerDirectives(self, self.compiler_directives),
-            _align_function_definitions,
             MarkClosureVisitor(self),
+            _align_function_definitions,
             ConstantFolding(),
             FlattenInListTransform(),
             WithTransform(self),
index 8f68673537772efe3134ecfa3cb7118ea4d0460e..1f3bbf30ffc390f06ad6ce122e49512618e8a98c 100644 (file)
@@ -1425,9 +1425,11 @@ class AlignFunctionDefinitions(CythonTransform):
                     error(pxd_def.pos, "previous declaration here")
                 return None
             node = node.as_cfunction(pxd_def)
-        elif self.scope.is_module_scope and self.directives['auto_cpdef']:
+        elif (self.scope.is_module_scope
+              and not node.needs_closure
+              and self.directives['auto_cpdef']):
             node = node.as_cfunction(scope=self.scope)
-        # Enable this when internal def functions are allowed.
+        # Enable this when nested cdef functions are allowed.
         # self.visitchildren(node)
         return node
 
index 2aeadbff8802b5b7106264544bbf67e1d0e31503..2aa611e0b99fe1bdc571e93b19d53670675f6997 100644 (file)
@@ -19,7 +19,6 @@ for_from_pyvar_loop_T601
 decorators_T593
 temp_sideeffects_T654
 class_scope_T671
-auto_cpdef_closures
 
 # CPython regression tests that don't current work:
 pyregr.test_threadsignals