1# ticket: 467 2 3def simple_parallel_assignment_from_call(): 4 """ 5 >>> simple_parallel_assignment_from_call() 6 (2, 1, 2, 1, 2, 1, 2, [1, 2], [1, 2]) 7 """ 8 cdef int ai, bi 9 cdef long al, bl 10 cdef object ao, bo 11 reset() 12 ai, bi = al, bl = ao, bo = c = d = [intval(1), intval(2)] 13 return call_count, ao, bo, ai, bi, al, bl, c, d 14 15def recursive_parallel_assignment_from_call_left(): 16 """ 17 >>> recursive_parallel_assignment_from_call_left() 18 (3, 1, 2, 3, 1, 2, 3, (1, 2), 3, [(1, 2), 3]) 19 """ 20 cdef int ai, bi, ci 21 cdef object ao, bo, co 22 reset() 23 (ai, bi), ci = (ao, bo), co = t,o = d = [(intval(1), intval(2)), intval(3)] 24 return call_count, ao, bo, co, ai, bi, ci, t, o, d 25 26def recursive_parallel_assignment_from_call_right(): 27 """ 28 >>> recursive_parallel_assignment_from_call_right() 29 (3, 1, 2, 3, 1, 2, 3, 1, (2, 3), [1, (2, 3)]) 30 """ 31 cdef int ai, bi, ci 32 cdef object ao, bo, co 33 reset() 34 ai, (bi, ci) = ao, (bo, co) = o,t = d = [intval(1), (intval(2), intval(3))] 35 return call_count, ao, bo, co, ai, bi, ci, o, t, d 36 37def recursive_parallel_assignment_from_call_left_reversed(): 38 """ 39 >>> recursive_parallel_assignment_from_call_left_reversed() 40 (3, 1, 2, 3, 1, 2, 3, (1, 2), 3, [(1, 2), 3]) 41 """ 42 cdef int ai, bi, ci 43 cdef object ao, bo, co 44 reset() 45 d = t,o = (ao, bo), co = (ai, bi), ci = [(intval(1), intval(2)), intval(3)] 46 return call_count, ao, bo, co, ai, bi, ci, t, o, d 47 48def recursive_parallel_assignment_from_call_right_reversed(): 49 """ 50 >>> recursive_parallel_assignment_from_call_right_reversed() 51 (3, 1, 2, 3, 1, 2, 3, 1, (2, 3), [1, (2, 3)]) 52 """ 53 cdef int ai, bi, ci 54 cdef object ao, bo, co 55 reset() 56 d = o,t = ao, (bo, co) = ai, (bi, ci) = [intval(1), (intval(2), intval(3))] 57 return call_count, ao, bo, co, ai, bi, ci, o, t, d 58 59cdef int call_count = 0 60cdef int next_expected_arg = 1 61 62cdef reset(): 63 global call_count, next_expected_arg 64 call_count = 0 65 next_expected_arg = 1 66 67cdef int intval(int x) except -1: 68 global call_count, next_expected_arg 69 call_count += 1 70 assert next_expected_arg == x, "calls not in source code order: expected %d, found %d" % (next_expected_arg, x) 71 next_expected_arg += 1 72 return x 73