diff --git a/test/Makefile b/test/Makefile index 37cd064a..bb5b0376 100644 --- a/test/Makefile +++ b/test/Makefile @@ -175,6 +175,12 @@ grammar-coverage-3.5: SPARK_PARSER_COVERAGE=$(COVER_DIR)/spark-grammar-35.cover $(PYTHON) test_pythonlib.py --bytecode-3.5 SPARK_PARSER_COVERAGE=$(COVER_DIR)/spark-grammar-35.cover $(PYTHON) test_pyenvlib.py --3.5.5 --max=800 +#: Get grammar coverage for Python 3.6 +grammar-coverage-3.5: + rm $(COVER_DIR)/spark-grammar-36.cover || /bin/true + SPARK_PARSER_COVERAGE=$(COVER_DIR)/spark-grammar-36.cover $(PYTHON) test_pythonlib.py --bytecode-3.6 + SPARK_PARSER_COVERAGE=$(COVER_DIR)/spark-grammar-36.cover $(PYTHON) test_pyenvlib.py --3.6.4 --max=800 + #: Check deparsing Python 2.6 check-bytecode-2.6: $(PYTHON) test_pythonlib.py --bytecode-2.6 --weak-verify diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index 922c739b..c5338418 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -761,15 +761,17 @@ class Scanner3(Scanner): if self.get_target(jump_back) >= 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): - self.fixed_jumps[offset] = jump_back+4 - end = jump_back+4 + jb_inst = self.get_inst(jump_back) + + jb_next_offset = self.next_offset(jb_inst.opcode, jump_back) + if end > jb_next_offset and self.is_jump_forward(end): + if self.is_jump_forward(jb_next_offset): + if self.get_target(jb_next_offset) == self.get_target(end): + self.fixed_jumps[offset] = jb_next_offset + end = jb_next_offset elif target < offset: - self.fixed_jumps[offset] = jump_back+4 - end = jump_back+4 + self.fixed_jumps[offset] = jb_next_offset + end = jb_next_offset target = self.get_target(jump_back)