2011-03-23 | Paul Boddie | file changeset files shortlog | Fixed function definitions to copy extra parameters before the frame is extended, otherwise the extended frame elements are erroneously copied into the star argument tuple. Added tests to check the behaviour of star argument initialisation in the presence of locals. Introduced a _tuple native method to convert lists to tuples. Updated the native library functions to use variables indicating the size of fragment headers. |
paul@408 | 1 | #!/usr/bin/env python |
paul@408 | 2 | |
paul@408 | 3 | def f(a, b, *c): |
paul@408 | 4 | d = 123 # introduce locals in the frame |
paul@408 | 5 | return c |
paul@408 | 6 | |
paul@408 | 7 | g = f |
paul@408 | 8 | |
paul@408 | 9 | r4 = g(1, 2, 3) |
paul@408 | 10 | r5 = g(1, b=2) |
paul@408 | 11 | r6 = g(1, 2, 3, 4) |
paul@408 | 12 | |
paul@408 | 13 | def g(a, c, *b): |
paul@408 | 14 | d = 123 # introduce locals in the frame |
paul@408 | 15 | return b |
paul@408 | 16 | |
paul@408 | 17 | r7 = g(1, c=2) |
paul@408 | 18 | r8 = g(1, 2, 3, 4) |
paul@408 | 19 | |
paul@408 | 20 | result_0 = len(r5) |
paul@408 | 21 | result_1 = len(r4) |
paul@408 | 22 | result_2 = len(r6) |
paul@408 | 23 | result2_0 = len(r7) |
paul@408 | 24 | result2_2 = len(r8) |
paul@408 | 25 | |
paul@408 | 26 | # vim: tabstop=4 expandtab shiftwidth=4 |