<2.7 "if" detection and dup Python 3 grammar rule

This commit is contained in:
rocky
2016-11-24 05:33:08 -05:00
parent cbcfd53dae
commit 8941417a54
2 changed files with 6 additions and 2 deletions

View File

@@ -446,10 +446,16 @@ class Scanner2(scan.Scanner):
if self.version < 2.7 and self.code[jmp] in self.jump_forward:
self.not_continue.add(jmp)
jmp = self.get_target(jmp)
prev_offset = self.prev[except_match]
# COMPARE_OP argument should be "exception match" or 10
if (self.code[prev_offset] == self.opc.COMPARE_OP and
self.code[prev_offset+1] != 10):
return None
if jmp not in self.pop_jump_if | self.jump_forward:
self.ignore_if.add(except_match)
return None
self.ignore_if.add(except_match)
self.not_continue.add(jmp)
return jmp