From: Dag Sverre Seljebotn Date: Sun, 20 Jul 2008 17:03:31 +0000 (+0200) Subject: Test case for for-loop assignment to buffer X-Git-Tag: 0.9.8.1~49^2~82 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d4d809306563855d574d51f77722cec3835cadbd;p=cython.git Test case for for-loop assignment to buffer --- diff --git a/tests/run/bufaccess.pyx b/tests/run/bufaccess.pyx index 14981d9e..d30baafb 100644 --- a/tests/run/bufaccess.pyx +++ b/tests/run/bufaccess.pyx @@ -39,6 +39,17 @@ __doc__ = u""" acquired A 0 1 2 3 4 5 released A + + #>>> forin_assignment([A, B, A], 3) + acquired A + 3 + released A + acquired B + 3 + released B + acquired A + 3 + released A >>> printbuf_float(MockBuffer("f", [1.0, 1.25, 0.75, 1.0]), (4,)) acquired @@ -99,6 +110,11 @@ def cdef_assignment(obj, n): print buf[i], print +def forin_assignment(objs, int pick): + cdef object[int] buf + for buf in objs: + print buf[pick] + def printbuf_float(o, shape): # should make shape builtin cdef object[float] buf