Author eric.fahlgren
Recipients eric.fahlgren
Date 2016-02-27.03:54:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456545250.68.0.0525262950792.issue26448@psf.upfronthosting.co.za>
In-reply-to
Content
When trying out dis.dis on some synthetically long functions, I noted that spurious branch targets were being generated in the output.  First one is at address 8:

157           0 LOAD_CONST               1 (1)
              3 DUP_TOP
              4 STORE_FAST               0 (z)
              7 DUP_TOP
        >>    8 STORE_FAST               1 (a)
             11 DUP_TOP

I dug into findlabels and notices that it pays no attention to EXTENDED_ARG.  The fix is pretty simple, basically copy pasta from dis._get_instructions_bytes, at line 369, in the 3.5.1 release code add all the "extended_arg" bits:

    extended_arg = 0
    while i < n:
        op = code[i]
        i = i+1
        if op >= HAVE_ARGUMENT:
            arg = code[i] + code[i+1]*256 + extended_arg
            extended_arg = 0
            i = i+2
            if op == EXTENDED_ARG:
                 extended_arg = arg*65536
            label = -1
History
Date User Action Args
2016-02-27 03:54:10eric.fahlgrensetrecipients: + eric.fahlgren
2016-02-27 03:54:10eric.fahlgrensetmessageid: <1456545250.68.0.0525262950792.issue26448@psf.upfronthosting.co.za>
2016-02-27 03:54:10eric.fahlgrenlinkissue26448 messages
2016-02-27 03:54:09eric.fahlgrencreate