Improve stack depth computation for try/except and try/finally

Add CONTINUE_LOOP to the list of unconditional transfers
This commit is contained in:
Jeremy Hylton 2001-08-29 22:27:14 +00:00
parent 4bd4dddd55
commit 9263848fa1
2 changed files with 8 additions and 2 deletions

View File

@ -267,7 +267,7 @@ class Block:
assert len(self.next) == 1, map(str, self.next)
_uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS',
'JUMP_ABSOLUTE', 'JUMP_FORWARD')
'JUMP_ABSOLUTE', 'JUMP_FORWARD', 'CONTINUE_LOOP')
def pruneNext(self):
"""Remove bogus edge for unconditional transfers
@ -753,6 +753,9 @@ class StackDepthTracker:
'IMPORT_STAR': -1,
'IMPORT_NAME': 0,
'IMPORT_FROM': 1,
# close enough...
'SETUP_EXCEPT': 3,
'SETUP_FINALLY': 3,
}
# use pattern match
patterns = [

View File

@ -267,7 +267,7 @@ class Block:
assert len(self.next) == 1, map(str, self.next)
_uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS',
'JUMP_ABSOLUTE', 'JUMP_FORWARD')
'JUMP_ABSOLUTE', 'JUMP_FORWARD', 'CONTINUE_LOOP')
def pruneNext(self):
"""Remove bogus edge for unconditional transfers
@ -753,6 +753,9 @@ class StackDepthTracker:
'IMPORT_STAR': -1,
'IMPORT_NAME': 0,
'IMPORT_FROM': 1,
# close enough...
'SETUP_EXCEPT': 3,
'SETUP_FINALLY': 3,
}
# use pattern match
patterns = [