COME_FROM for 3.x POP_EXCEPT, DRY with op_name() ...

Start adding COME_FROMs for POP_EXCEPT in preparation for
getting tryelse blocks correct.

Simpler opname access functions:
  - self.op_name(op) is self.opc.opname[op]
  - self.op_name_from_offset(offset) is self.opc.opname[self.code[offset]]

verify.py: not all offsets are ints
This commit is contained in:
rocky
2017-03-01 05:50:31 -05:00
parent e1111e3f50
commit 160ec0d9cc
4 changed files with 34 additions and 19 deletions

View File

@@ -66,6 +66,12 @@ class Scanner(object):
# FIXME: This weird Python2 behavior is not Python3
self.resetTokenClass()
def opname_for_offset(self, offset):
return self.opc.opname[self.code[offset]]
def op_name(self, op):
return self.opc.opname[op]
def is_jump_forward(self, offset):
"""
Return True if the code at offset is some sort of jump forward.