From 9263848fa154ad2ba5288bf5adeda22d7c90f8a2 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 29 Aug 2001 22:27:14 +0000 Subject: Improve stack depth computation for try/except and try/finally Add CONTINUE_LOOP to the list of unconditional transfers --- Lib/compiler/pyassem.py | 5 ++++- Tools/compiler/compiler/pyassem.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py index 413a954..dc01656 100644 --- a/Lib/compiler/pyassem.py +++ b/Lib/compiler/pyassem.py @@ -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 = [ diff --git a/Tools/compiler/compiler/pyassem.py b/Tools/compiler/compiler/pyassem.py index 413a954..dc01656 100644 --- a/Tools/compiler/compiler/pyassem.py +++ b/Tools/compiler/compiler/pyassem.py @@ -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 = [ -- cgit v0.12