Remove hacky 3.x offset address arithmetic

This commit is contained in:
rocky
2018-03-26 14:50:17 -04:00
parent 75245ba38c
commit c5f8bbf32d
2 changed files with 16 additions and 8 deletions

View File

@@ -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_pythonlib.py --bytecode-3.5
SPARK_PARSER_COVERAGE=$(COVER_DIR)/spark-grammar-35.cover $(PYTHON) test_pyenvlib.py --3.5.5 --max=800 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 deparsing Python 2.6
check-bytecode-2.6: check-bytecode-2.6:
$(PYTHON) test_pythonlib.py --bytecode-2.6 --weak-verify $(PYTHON) test_pythonlib.py --bytecode-2.6 --weak-verify

View File

@@ -761,15 +761,17 @@ class Scanner3(Scanner):
if self.get_target(jump_back) >= next_line_byte: if self.get_target(jump_back) >= next_line_byte:
jump_back = self.last_instr(start, end, self.opc.JUMP_ABSOLUTE, start, False) jump_back = self.last_instr(start, end, self.opc.JUMP_ABSOLUTE, start, False)
# This is wrong for 3.6+ jb_inst = self.get_inst(jump_back)
if end > jump_back+4 and self.is_jump_forward(end):
if self.is_jump_forward(jump_back+4): jb_next_offset = self.next_offset(jb_inst.opcode, jump_back)
if self.get_target(jump_back+4) == self.get_target(end): if end > jb_next_offset and self.is_jump_forward(end):
self.fixed_jumps[offset] = jump_back+4 if self.is_jump_forward(jb_next_offset):
end = jump_back+4 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: elif target < offset:
self.fixed_jumps[offset] = jump_back+4 self.fixed_jumps[offset] = jb_next_offset
end = jump_back+4 end = jb_next_offset
target = self.get_target(jump_back) target = self.get_target(jump_back)