New submission from Eric Fahlgren: 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 ---------- components: Library (Lib) messages: 260913 nosy: eric.fahlgren priority: normal severity: normal status: open title: dis.findlabels ignores EXTENDED_ARG type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com