Python 3.4 assertion handling. Improve verify

3.4 has jump optimization like 3.5.
verify.py: show mismatch on verification mismatch
This commit is contained in:
rocky
2016-07-14 05:19:16 -04:00
parent 1e25ffa879
commit 7b7a9fa4cf
10 changed files with 35 additions and 10 deletions

View File

@@ -125,8 +125,14 @@ class Scanner26(scan.Scanner2):
codelen = len(self.code)
# Scan for assertions. Later we will
# turn 'LOAD_GLOBAL' to 'LOAD_ASSERT'.
# 'LOAD_ASSERT' is used in assert statements.
self.load_asserts = set()
for i in self.op_range(0, n):
# We need to detect the difference between
# "raise AssertionError" and
# "assert"
if (self.code[i] == self.opc.JUMP_IF_TRUE and
i + 4 < codelen and
self.code[i+3] == self.opc.POP_TOP and