mirror of
https://github.com/python/cpython.git
synced 2025-08-20 00:32:12 +00:00
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. (backport from rev. 53575)
This commit is contained in:
parent
b17830e709
commit
20aa477a2d
4 changed files with 38 additions and 1 deletions
|
@ -851,6 +851,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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue