Re: AST: jump offsets wrong when EXTENDED_ARG is used

Neal Norwitz <[email protected]> Sun, 23 Oct 2005 18:34:39 -0700
Newsgroups gmane.comp.python.compiler
Message-ID <[email protected]>
On 10/23/05, Neil Schemenauer <[email protected]> wrote:
>
> I wonder if the old compiler and the compiler package get this right.

Minor variation on Armins code (move the %s from before the loop to
inside the loop):

longexpr = 'x = x or ' + '-x' * 2500
code = '''
def f(x):
    while x:
        %s
        %s
        %s
        %s
        %s
        %s
        %s
        %s
        %s
        %s
        x -= 1
        # EXTENDED_ARG/JUMP_ABSOLUTE here
    return x
''' % ((longexpr,)*10)

exec code
f(5)

Works in CVS (at least it seems to work), but in 2.4 produces:
  SystemError: com_backpatch: offset too large