From: Dag Sverre Seljebotn Date: Fri, 15 Aug 2008 16:12:37 +0000 (+0200) Subject: Testcase for C array inplace operators X-Git-Tag: 0.9.8.1~37 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff7fc826d43fc770f42143c86eadfb440b1d0a75;p=cython.git Testcase for C array inplace operators --- 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)