Index: Lib/compiler/symbols.py =================================================================== --- Lib/compiler/symbols.py (revision 51334) +++ Lib/compiler/symbols.py (working copy) @@ -328,6 +328,12 @@ if node.else_: self.visit(node.else_, scope) + def visitWith(self, node, scope): + self.visit(node.expr, scope) + if node.vars is not None: + self.visit(node.vars, scope, 1) + self.visit(node.body, scope) + def visitFrom(self, node, scope): for name, asname in node.names: if name == "*": Index: Lib/compiler/pycodegen.py =================================================================== --- Lib/compiler/pycodegen.py (revision 51334) +++ Lib/compiler/pycodegen.py (working copy) @@ -851,6 +851,8 @@ 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() Index: Lib/compiler/pyassem.py =================================================================== --- Lib/compiler/pyassem.py (revision 51334) +++ Lib/compiler/pyassem.py (working copy) @@ -380,8 +380,6 @@ pc = 0 for t in self.insts: opname = t[0] - if opname == "SET_LINENO": - print if len(t) == 1: print "\t", "%3d" % pc, opname pc = pc + 1 Index: Lib/compiler/transformer.py =================================================================== --- Lib/compiler/transformer.py (revision 51334) +++ Lib/compiler/transformer.py (working copy) @@ -954,7 +954,7 @@ return try_except def com_with(self, nodelist): - # with_stmt: 'with' expr [with_var] ':' suite + # with_stmt: 'with' expr [as with_var] ':' suite expr = self.com_node(nodelist[1]) body = self.com_node(nodelist[-1]) if nodelist[2][0] == token.COLON: