From bd6a80ee495650ec9801d768f515d72b7fbb14ab Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 28 Oct 2008 12:49:48 -0700 Subject: [PATCH] Fix ticket #98, better error reporting on bad types. --- Cython/Compiler/PyrexTypes.py | 4 ++++ tests/errors/e_badtypeuse.pyx | 4 ++++ 2 files changed, 8 insertions(+) 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 """ -- 2.26.2