cython-devel

changeset 1277:d6b77994c455

Fix ticket #98, better error reporting on bad types.
author Robert Bradshaw <robertwb@math.washington.edu>
date Tue Oct 28 12:49:48 2008 -0700 (3 years ago)
parents 0436eceaa22c
children dd01656b3e82
files Cython/Compiler/PyrexTypes.py tests/errors/e_badtypeuse.pyx
line diff
1.1 --- a/Cython/Compiler/PyrexTypes.py Tue Oct 28 12:52:43 2008 -0300 1.2 +++ b/Cython/Compiler/PyrexTypes.py Tue Oct 28 12:49:48 2008 -0700 1.3 @@ -1313,6 +1313,8 @@ 1.4 # Construct a C array type. 1.5 if base_type is c_char_type: 1.6 return CCharArrayType(size) 1.7 + elif base_type is error_type: 1.8 + return error_type 1.9 else: 1.10 return CArrayType(base_type, size) 1.11 1.12 @@ -1320,6 +1322,8 @@ 1.13 # Construct a C pointer type. 1.14 if base_type is c_char_type: 1.15 return c_char_ptr_type 1.16 + elif base_type is error_type: 1.17 + return error_type 1.18 else: 1.19 return CPtrType(base_type) 1.20
2.1 --- a/tests/errors/e_badtypeuse.pyx Tue Oct 28 12:52:43 2008 -0300 2.2 +++ b/tests/errors/e_badtypeuse.pyx Tue Oct 28 12:49:48 2008 -0700 2.3 @@ -19,6 +19,9 @@ 2.4 void v, # incomplete argument type 2.5 int a[]): 2.6 pass 2.7 + 2.8 +cdef NoSuchType* ptr 2.9 +ptr = None # This should not produce another error 2.10 2.11 _ERRORS = u""" 2.12 3:19: Python object cannot be declared extern 2.13 @@ -35,4 +38,5 @@ 2.14 19:1: Use spam() rather than spam(void) to declare a function with no arguments. 2.15 18:7: Argument type 'Grail' is incomplete 2.16 19:1: Invalid use of 'void' 2.17 +23:5: 'NoSuchType' is not a type identifier 2.18 """