From f6aa775d588085e0db13ea4b9e027b19fbb1a43f Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 25 Feb 2018 21:06:57 -0500 Subject: [PATCH] EXTENDED_ARG in 3.6 fixes 3.6 uses EXTENDED_ARG more often appearing as the targets of jump instructions at the beginning of line statements. All of this wreaks havoc in the current way that our instruction processing works --- uncompyle6/scanners/scanner3.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index 499a746d..659571fb 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -275,6 +275,10 @@ class Scanner3(Scanner): for jump_offset in sorted(jump_targets[inst.offset], reverse=True): come_from_name = 'COME_FROM' opname = self.opname_for_offset(jump_offset) + if opname == 'EXTENDED_ARG': + j = xdis.next_offset(op, self.opc, jump_offset) + opname = self.opname_for_offset(j) + if opname.startswith('SETUP_'): come_from_type = opname[len('SETUP_'):] come_from_name = 'COME_FROM_%s' % come_from_type @@ -545,7 +549,12 @@ class Scanner3(Scanner): if inst.has_arg: label = self.fixed_jumps.get(offset) oparg = inst.arg - next_offset = xdis.next_offset(op, self.opc, offset) + if (self.version >= 3.6 and + self.code[offset] == self.opc.EXTENDED_ARG): + j = xdis.next_offset(op, self.opc, offset) + next_offset = xdis.next_offset(op, self.opc, j) + else: + next_offset = xdis.next_offset(op, self.opc, offset) if label is None: if op in op3.hasjrel and op != self.opc.FOR_ITER: