diff options
-rw-r--r-- | talinterpreter.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/talinterpreter.py b/talinterpreter.py index de25ae7..9690c49 100644 --- a/talinterpreter.py +++ b/talinterpreter.py @@ -962,14 +962,16 @@ class TALInterpreter(object): chopped = macs[i:] del macs[i:] prev_source = self.sourceFile - self.interpret(slot) - if self.sourceFile != prev_source: - self.engine.setSourceFile(prev_source) - self.sourceFile = prev_source - # Restore the stack entries. - for mac in chopped: - mac.entering = False # Not entering - macs.extend(chopped) + try: + self.interpret(slot) + finally: + if self.sourceFile != prev_source: + self.engine.setSourceFile(prev_source) + self.sourceFile = prev_source + # Restore the stack entries. + for mac in chopped: + mac.entering = False # Not entering + macs.extend(chopped) return # Falling out of the 'if' allows the macro to be interpreted. self.interpret(block) |