Patch #1638243: the compiler package is now able to correctly compile

a with statement; previously, executing code containing a with statement
compiled by the compiler package crashed the interpreter.
This commit is contained in:
Georg Brandl 2007-01-27 17:43:02 +00:00
parent 7a7cbae77b
commit ab49684f55
4 changed files with 38 additions and 1 deletions

View file

@ -849,6 +849,8 @@ class CodeGenerator:
self.emit('LOAD_CONST', None)
self.nextBlock(final)
self.setups.push((END_FINALLY, final))
self._implicitNameOp('LOAD', exitvar)
self._implicitNameOp('DELETE', exitvar)
self.emit('WITH_CLEANUP')
self.emit('END_FINALLY')
self.setups.pop()