2.6 and before COME_FROM handling...

also, add in some of the test bytecode from the python-2.4 branch
This commit is contained in:
rocky
2018-03-04 21:42:59 -05:00
parent def9e1676b
commit 9e815d8d79
8 changed files with 21 additions and 3 deletions

View File

@@ -1127,7 +1127,13 @@ class Scanner2(Scanner):
source = self.setup_loops[label]
else:
source = offset
targets[label] = targets.get(label, []) + [source]
# FIXME: The grammar for 2.6 and before doesn't
# handle COME_FROM's from a loop inside if's
# It probably should.
if (self.version > 2.6 or
self.code[source] != self.opc.SETUP_LOOP or
self.code[label] != self.opc.JUMP_FORWARD):
targets[label] = targets.get(label, []) + [source]
pass
pass
pass