From: Stefan Behnel Date: Tue, 5 Aug 2008 06:41:15 +0000 (+0200) Subject: reverted rev 908 as it breaks using type names as argument names (such as 'file') X-Git-Tag: 0.9.8.1~94 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bbe9f1cb03bef32509f0dee76193e122c1e018a6;p=cython.git reverted rev 908 as it breaks using type names as argument names (such as 'file') --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 2b4d069a..d06324c9 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -362,13 +362,8 @@ class CNameDeclaratorNode(CDeclaratorNode): def analyse(self, base_type, env, nonempty = 0): if nonempty and self.name == '': - raise RuntimeError - # May have mistaken the name for the type. - if base_type.is_ptr or base_type.is_array or base_type.is_buffer: - error(self.pos, "Missing argument name.") - elif base_type.is_void: - error(self.pos, "Use spam() rather than spam(void) to declare a function with no arguments.") - self.name = base_type.declaration_code("", for_display=1, pyrex=1) + # Must have mistaken the name for the type. + self.name = base_type.name base_type = py_object_type self.type = base_type return self, base_type @@ -429,7 +424,7 @@ class CFuncDeclaratorNode(CDeclaratorNode): def analyse(self, return_type, env, nonempty = 0): func_type_args = [] for arg_node in self.args: - name_declarator, type = arg_node.analyse(env) + name_declarator, type = arg_node.analyse(env, nonempty = nonempty) name = name_declarator.name if name_declarator.cname: error(self.pos, diff --git a/tests/compile/cargdef.pyx b/tests/compile/cargdef.pyx index c5da39bb..c8064d0b 100644 --- a/tests/compile/cargdef.pyx +++ b/tests/compile/cargdef.pyx @@ -1,10 +1,3 @@ def f(obj, int i, float f, char *s1, char s2[]): pass - -cdef g(obj, int i, float f, char *s1, char s2[]): - pass - -cdef do_g(object (*func)(object, int, float, char*, char*)): - return func(1, 2, 3.14159, "a", "b") - -do_g(&g) + \ No newline at end of file