1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
# ticket: 241
# mode: error
cdef some_function(x, y):
pass
cdef class A:
cdef some_method(self, x, y=1):
pass
from libc.string cimport strcmp
cdef extern from "string.h":
char *strstr(char*, char*)
# ok
some_function(1, 2)
some_function(1, y=2)
# nok
some_function(1, x=1)
some_function(1, x=2, y=2)
some_function(1, y=2, z=3)
some_function(1, z=3)
some_function(1, 2, z=3)
some_function(x=1, y=2, z=3)
some_function(x=1, y=2, x=1)
some_function(x=1, y=2, x=1, z=3)
cdef A a = A()
# ok
a.some_method(1)
a.some_method(1, 2)
a.some_method(1, y=2)
a.some_method(x=1, y=2)
# nok
a.some_method(1, x=1)
a.some_method(1, 2, x=1)
a.some_method(1, 2, y=2)
a.some_method(1, 2, x=1, y=2)
a.some_method(1, 2, y=2, x=1)
a.some_method(1, y=2, x=1)
a.some_method(1, 2, z=3)
a.some_method(1, y=2, z=3)
a.some_method(x=1, x=1)
a.some_method(x=1, x=1, y=2)
a.some_method(x=1, y=2, x=1)
# ok
strcmp("abc", "cde")
strcmp("abc", s2="cde")
strcmp(s1="abc", s2="cde")
strcmp(s2="cde", s1="abc")
# nok
strcmp("abc", s1="cde")
strcmp("abc", s2="cde", s1="cde")
strcmp(s1="abc", s2="cde", s1="cde")
strcmp(s2="cde", s1="abc", s2="cde")
# ok
strstr("abc", "abcdef")
# nok
strstr("abc", char="abcdef")
strstr("abc", "abcdef", char="xyz")
_ERRORS = u"""
22:18: argument 'x' passed twice
23:18: argument 'x' passed twice
24:23: C function got unexpected keyword argument 'z'
25:18: C function got unexpected keyword argument 'z'
26:21: C function got unexpected keyword argument 'z'
27:25: C function got unexpected keyword argument 'z'
28:25: argument 'x' passed twice
29:25: argument 'x' passed twice
29:30: C function got unexpected keyword argument 'z'
39:18: argument 'x' passed twice
40:21: argument 'x' passed twice
41:21: argument 'y' passed twice
42:21: argument 'x' passed twice
42:26: argument 'y' passed twice
43:21: argument 'y' passed twice
43:26: argument 'x' passed twice
44:23: argument 'x' passed twice
45:21: C function got unexpected keyword argument 'z'
46:23: C function got unexpected keyword argument 'z'
47:20: argument 'x' passed twice
48:20: argument 'x' passed twice
49:25: argument 'x' passed twice
58:16: argument 's1' passed twice
59:26: argument 's1' passed twice
60:29: argument 's1' passed twice
61:29: argument 's2' passed twice
67:18: C function got unexpected keyword argument 'char'
68:28: C function got unexpected keyword argument 'char'
"""
|