Cython has moved to github.
cython-devel
view tests/run/bad_c_struct_T252.pyx @ 2658:4208042ceeae
Fix bug #252, mangle illegal optional c argument names.
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Wed Nov 04 21:41:14 2009 -0800 (2 years ago) |
| parents | 82d312a9f1fc |
| children |
line source
1 cdef cf(default=None):
2 return default
4 cpdef cpf(default=100):
5 """
6 >>> cpf()
7 100
8 >>> cpf(1)
9 1
10 >>> cpf(default=2)
11 2
12 """
13 default = cf(default)
14 return default
16 def pf(default=100):
17 """
18 >>> pf()
19 100
20 >>> pf(1)
21 1
22 >>> pf(default=2)
23 2
24 """
25 return default
28 cdef struct foo:
29 int void
30 int default
32 def test_struct():
33 """
34 >>> test_struct()
35 (1, 2)
36 """
37 cdef foo foo_struct
38 foo_struct.void = 1
39 foo_struct.default = 2
40 return foo_struct.void, foo_struct.default
43 cdef class Foo:
44 cdef int void
45 cdef int default
47 def test_class():
48 """
49 >>> test_class()
50 (1, 2)
51 """
52 cdef Foo foo_instance = Foo()
53 foo_instance.void = 1
54 foo_instance.default = 2
55 return foo_instance.void, foo_instance.default
