From: Robert Bradshaw Date: Sat, 20 Feb 2010 02:04:56 +0000 (-0800) Subject: Compiler crash on calling non-entry function. X-Git-Tag: 0.13.beta0~341 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0a0e72a79b9c4f3608b0a520590e42ed4247eefc;p=cython.git Compiler crash on calling non-entry function. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 20cc4ca5..7d1eccfb 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2600,7 +2600,14 @@ class SimpleCallNode(CallNode): return self.function.entry = entry self.function.type = entry.type - func_type = self.function_type() + func_type = self.function_type() + else: + func_type = self.function_type() + if not func_type.is_cfunction: + error(self.pos, "Calling non-function type '%s'" % func_type) + self.type = PyrexTypes.error_type + self.result_code = "" + return # Check no. of args max_nargs = len(func_type.args) expected_nargs = max_nargs - func_type.optional_arg_count diff --git a/tests/errors/e_callnonfunction.pyx b/tests/errors/e_callnonfunction.pyx index 17f4bdce..0f4c19ef 100644 --- a/tests/errors/e_callnonfunction.pyx +++ b/tests/errors/e_callnonfunction.pyx @@ -8,7 +8,13 @@ ctypedef struct s: # FIXME: this might be worth an error ... int x s() +cdef int x(): + return 0 + +x()() + _ERRORS = u""" 2:1: Calling non-function type 'int' 5:1: Calling non-function type 'float' +14:3: Calling non-function type 'int' """