From ff7fc826d43fc770f42143c86eadfb440b1d0a75 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 15 Aug 2008 18:12:37 +0200 Subject: [PATCH] Testcase for C array inplace operators --- tests/run/inplace.pyx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/run/inplace.pyx b/tests/run/inplace.pyx index 7c9ba9ce..41528d63 100644 --- a/tests/run/inplace.pyx +++ b/tests/run/inplace.pyx @@ -7,6 +7,9 @@ __doc__ = u""" >>> h(56, 7) 105.0 + + >>> arrays() + 19 """ def f(a,b): @@ -26,3 +29,16 @@ def h(double a, double b): a += b a *= b return a + +cimport stdlib + +def arrays(): + cdef char* buf = stdlib.malloc(10) + cdef int i = 2 + cdef object j = 2 + buf[2] = 0 + buf[i] += 2 + buf[2] *= 10 + buf[j] -= 1 + print buf[2] + stdlib.free(buf) -- 2.26.2