From 345ce9b8968518cb5d13d945f0ac361cf2ed9a9b Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 17 Jan 2009 01:25:34 -0800 Subject: [PATCH] test for temp allocation bug in call --- tests/run/call_crash.pyx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/run/call_crash.pyx 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 -- 2.26.2