Cython has moved to github.
cython-devel
view tests/run/call_crash.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | |
| children | 0310198e281e |
line source
1 __doc__ = """
2 >>> A().test(3)
3 9
4 """
6 cdef class A:
8 cdef int (*func_ptr)(int)
10 def __init__(self):
11 self.func_ptr = &func
13 cdef int do_it(self, int s):
14 cdef int r = first_call(self).func_ptr(s) # the temp for first_call(self) not properly freed
15 return r
17 def test(self, s):
18 return self.do_it(s)
20 cdef A first_call(A x):
21 return x
23 cdef int func(int s):
24 return s*s
