diff --git a/test/bytecode_3.6/10_long_pop_jump.pyc b/test/bytecode_3.6/10_long_pop_jump.pyc new file mode 100644 index 00000000..d32e717a Binary files /dev/null and b/test/bytecode_3.6/10_long_pop_jump.pyc differ diff --git a/test/simple_source/bug36/10_long_pop_jump.py b/test/simple_source/bug36/10_long_pop_jump.py new file mode 100644 index 00000000..ad6c4de7 --- /dev/null +++ b/test/simple_source/bug36/10_long_pop_jump.py @@ -0,0 +1,50 @@ +# From 3.6 _markupbase.py + +# Bug is that the routine is long enough that POP_JUMP_IF_FALSE instruciton has an +# EXTENDED_ARG intruction before it and we weren't picking out the jump offset properly + +def parse_declaration(self, i): + if rawdata[j:j] in ("-", ""): + return -1 + n = len(rawdata) + if rawdata[j:j+2] == '-': + return self.parse_comment(i) + elif rawdata[j] == '[': + return self.parse_marked_section(i) + else: + decltype, j = self._scan_name(j, i) + if j < 0: + return j + if decltype == "d": + self._decl_otherchars = '' + while j < n: + c = rawdata[j] + if c == ">": + data = rawdata[i+2:j] + if decltype == "d": + self.handle_decl(data) + else: + self.unknown_decl(data) + return j + 1 + if c in "'": + m = _declstringlit_match(rawdata, j) + if not m: + return -1 + j = m.end() + elif c in "a": + name, j = self._scan_name(j, i) + elif c: + j += 1 + elif c == "[": + if decltype == "d": + j = self._parse_doctype_subset(j + 1, i) + elif decltype in {"attlist", "linktype", "link", "element"}: + self.error("unsupported '[' char in %s declaration" % decltype) + else: + self.error("unexpected '[' char in declaration") + else: + self.error( + "unexpected %r char in declaration" % rawdata[j]) + if j < 0: + return j + return -1 diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index a15950fb..b822e70d 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -716,6 +716,8 @@ class Scanner3(Scanner): else: if self.get_target(jump_back, 0) >= next_line_byte: jump_back = self.last_instr(start, end, self.opc.JUMP_ABSOLUTE, start, False) + + # This is wrong for 3.6+ if end > jump_back+4 and self.is_jump_forward(end): if self.is_jump_forward(jump_back+4): if self.get_target(jump_back+4) == self.get_target(end): @@ -753,8 +755,8 @@ class Scanner3(Scanner): 'start': after_jump_offset, 'end': end}) elif op in self.pop_jump_tf: - start = offset + instruction_size(op, self.opc) - target = self.get_target(offset) + start = offset + instruction_size(op, self.opc) + target = self.insts[inst_index].argval rtarget = self.restrict_to_parent(target, parent) prev_op = self.prev_op