From: Stefan Behnel Date: Sun, 24 Jan 2010 15:47:16 +0000 (+0100) Subject: test case for #467 X-Git-Tag: 0.12.1~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=656037fca5ffdf71604e00635dd49ebb493bbf8a;p=cython.git test case for #467 --- diff --git a/tests/bugs.txt b/tests/bugs.txt index 55e7e2c3..8a1b3fd7 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -7,3 +7,4 @@ numpy_ValueError_T172 unsignedbehaviour_T184 missing_baseclass_in_predecl_T262 cfunc_call_tuple_args_T408 +cascaded_list_unpacking_T467 diff --git a/tests/run/cascaded_list_unpacking_T467.pyx b/tests/run/cascaded_list_unpacking_T467.pyx new file mode 100644 index 00000000..14f00e54 --- /dev/null +++ b/tests/run/cascaded_list_unpacking_T467.pyx @@ -0,0 +1,32 @@ + +def simple_parallel_assignment_from_call(): + """ + >>> simple_parallel_assignment_from_call() + (2, 1, 2, 1, 2, 1, 2, [1, 2], [1, 2]) + """ + cdef int ai, bi + cdef long al, bl + cdef object ao, bo + cdef int side_effect_count = call_count + ai, bi = al, bl = ao, bo = c = d = [intval(1), intval(2)] + side_effect_count = call_count - side_effect_count + return side_effect_count, ao, bo, ai, bi, al, bl, c, d + +def recursive_parallel_assignment_from_call(): + """ + >>> recursive_parallel_assignment_from_call() + (3, 1, 2, 3, 1, 2, 3, (1, 2), 3, [(1, 2), 3]) + """ + cdef int ai, bi, ci + cdef object ao, bo, co + cdef int side_effect_count = call_count + (ai, bi), ci = (ao, bo), co = t,o = d = [(intval(1), intval(2)), intval(3)] + side_effect_count = call_count - side_effect_count + return side_effect_count, ao, bo, co, ai, bi, ci, t, o, d + +cdef int call_count = 0 + +cdef int intval(int x): + global call_count + call_count += 1 + return x