Allow extern "functions" (e.g. macros) to return array types.
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 29 Jan 2011 09:25:51 +0000 (01:25 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 29 Jan 2011 09:25:51 +0000 (01:25 -0800)
Cython/Compiler/Nodes.py

index 35d2b88a0e58c28b484b9de8425b974152f2e338..9251e0189c5f7fd71b98a4a7f0731ca9fd4fd4a8 100644 (file)
@@ -607,9 +607,6 @@ class CFuncDeclaratorNode(CDeclaratorNode):
                             error(self.exception_value.pos,
                                   "Exception value incompatible with function return type")
             exc_check = self.exception_check
-        if return_type.is_array:
-            error(self.pos,
-                "Function cannot return an array")
         if return_type.is_cfunction:
             error(self.pos,
                 "Function cannot return a function")
@@ -1656,6 +1653,9 @@ class CFuncDefNode(FuncDefNode):
             api = self.api, modifiers = self.modifiers)
         self.entry.inline_func_in_pxd = self.inline_in_pxd
         self.return_type = type.return_type
+        if self.return_type.is_array and visibility != 'extern':
+            error(self.pos,
+                "Function cannot return an array")
 
         if self.overridable and not env.is_module_scope:
             if len(self.args) < 1 or not self.args[0].type.is_pyobject: