Commit c66708bd authored by Stefan Behnel's avatar Stefan Behnel

make auto_cpdef play nicely with closure functions

parent 920ddf72
...@@ -135,8 +135,8 @@ class Context(object): ...@@ -135,8 +135,8 @@ class Context(object):
PostParse(self), PostParse(self),
_specific_post_parse, _specific_post_parse,
InterpretCompilerDirectives(self, self.compiler_directives), InterpretCompilerDirectives(self, self.compiler_directives),
_align_function_definitions,
MarkClosureVisitor(self), MarkClosureVisitor(self),
_align_function_definitions,
ConstantFolding(), ConstantFolding(),
FlattenInListTransform(), FlattenInListTransform(),
WithTransform(self), WithTransform(self),
......
...@@ -1425,9 +1425,11 @@ class AlignFunctionDefinitions(CythonTransform): ...@@ -1425,9 +1425,11 @@ class AlignFunctionDefinitions(CythonTransform):
error(pxd_def.pos, "previous declaration here") error(pxd_def.pos, "previous declaration here")
return None return None
node = node.as_cfunction(pxd_def) 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) 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) # self.visitchildren(node)
return node return node
......
...@@ -19,7 +19,6 @@ for_from_pyvar_loop_T601 ...@@ -19,7 +19,6 @@ for_from_pyvar_loop_T601
decorators_T593 decorators_T593
temp_sideeffects_T654 temp_sideeffects_T654
class_scope_T671 class_scope_T671
auto_cpdef_closures
# CPython regression tests that don't current work: # CPython regression tests that don't current work:
pyregr.test_threadsignals pyregr.test_threadsignals
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment