e_badtypeuse.pyx 1.41 KB
Newer Older
1 2
# mode: error

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
cdef struct Grail

cdef extern object xobj # Python object cannot be extern
cdef object aobj[42]    # array element cannot be Python object
cdef object *pobj       # pointer base type cannot be Python object

cdef int spam[] # incomplete variable type
cdef Grail g     # incomplete variable type
cdef void nada   # incomplete variable type

cdef int a_spam[17][]  # incomplete element type
cdef Grail a_g[42]     # incomplete element type
cdef void a_nada[88]   # incomplete element type

cdef struct Eggs:
	int spam[]

cdef f(Grail g,   # incomplete argument type
	void v,         # incomplete argument type
	int a[]):
		pass
24

25 26
cdef NoSuchType* ptr
ptr = None             # This should not produce another error
27 28

_ERRORS = u"""
29 30 31 32 33 34 35 36 37 38
5:19: Python object cannot be declared extern
6:16: Array element cannot be a Python object
7:12: Pointer base type cannot be a Python object
9:13: Variable type 'int []' is incomplete
10:11: Variable type 'Grail' is incomplete
11:10: Variable type 'void' is incomplete
13:15: Array element type 'int []' is incomplete
14:14: Array element type 'Grail' is incomplete
15:16: Array element type 'void' is incomplete
18:9: Variable type 'int []' is incomplete
39
#19:1: Function argument cannot be void
40 41 42 43
21:1: Use spam() rather than spam(void) to declare a function with no arguments.
20:7: Argument type 'Grail' is incomplete
21:1: Invalid use of 'void'
25:5: 'NoSuchType' is not a type identifier
44
"""