From: Robert Bradshaw Date: Sat, 17 Jan 2009 09:25:34 +0000 (-0800) Subject: test for temp allocation bug in call X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=345ce9b8968518cb5d13d945f0ac361cf2ed9a9b;p=cython.git test for temp allocation bug in call --- diff --git a/tests/run/call_crash.pyx b/tests/run/call_crash.pyx new file mode 100644 index 00000000..6131d896 --- /dev/null +++ b/tests/run/call_crash.pyx @@ -0,0 +1,24 @@ +__doc__ = """ + >>> A().test(3) + 9 +""" + +cdef class A: + + cdef int (*func_ptr)(int) + + def __init__(self): + self.func_ptr = &func + + cdef int do_it(self, int s): + cdef int r = first_call(self).func_ptr(s) # the temp for first_call(self) not properly freed + return r + + def test(self, s): + return self.do_it(s) + +cdef A first_call(A x): + return x + +cdef int func(int s): + return s*s