test for temp allocation bug in call
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 17 Jan 2009 09:25:34 +0000 (01:25 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 17 Jan 2009 09:25:34 +0000 (01:25 -0800)
tests/run/call_crash.pyx [new file with mode: 0644]

diff --git a/tests/run/call_crash.pyx b/tests/run/call_crash.pyx
new file mode 100644 (file)
index 0000000..6131d89
--- /dev/null
@@ -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