From: Robert Bradshaw Date: Tue, 28 Oct 2008 19:49:48 +0000 (-0700) Subject: Fix ticket #98, better error reporting on bad types. X-Git-Tag: 0.9.9.2.beta~2^2~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bd6a80ee495650ec9801d768f515d72b7fbb14ab;p=cython.git Fix ticket #98, better error reporting on bad types. --- diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 1e6096a1..70330959 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1313,6 +1313,8 @@ def c_array_type(base_type, size): # Construct a C array type. if base_type is c_char_type: return CCharArrayType(size) + elif base_type is error_type: + return error_type else: return CArrayType(base_type, size) @@ -1320,6 +1322,8 @@ def c_ptr_type(base_type): # Construct a C pointer type. if base_type is c_char_type: return c_char_ptr_type + elif base_type is error_type: + return error_type else: return CPtrType(base_type) diff --git a/tests/errors/e_badtypeuse.pyx b/tests/errors/e_badtypeuse.pyx index 3814a1ac..ce29c055 100644 --- a/tests/errors/e_badtypeuse.pyx +++ b/tests/errors/e_badtypeuse.pyx @@ -19,6 +19,9 @@ cdef f(Grail g, # incomplete argument type void v, # incomplete argument type int a[]): pass + +cdef NoSuchType* ptr +ptr = None # This should not produce another error _ERRORS = u""" 3:19: Python object cannot be declared extern @@ -35,4 +38,5 @@ _ERRORS = u""" 19:1: Use spam() rather than spam(void) to declare a function with no arguments. 18:7: Argument type 'Grail' is incomplete 19:1: Invalid use of 'void' +23:5: 'NoSuchType' is not a type identifier """