Mercurial > cpython-lru_cache-weakref
diff Lib/compiler/pycodegen.py @ 20547:a12ccdbce8da legacy-trunk
Whitespace normalization.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Thu, 18 Oct 2001 21:57:37 +0000 |
| parents | 41799b70a96c |
| children | ee1437f5de03 |
line wrap: on
line diff
--- a/Lib/compiler/pycodegen.py Thu Oct 18 21:24:04 2001 +0000 +++ b/Lib/compiler/pycodegen.py Thu Oct 18 21:57:37 2001 +0000 @@ -36,7 +36,7 @@ class BlockStack(misc.Stack): __super_init = misc.Stack.__init__ - + def __init__(self): self.__super_init(self) self.loop = None @@ -59,7 +59,7 @@ """Replacement for builtin compile() function""" if flags is not None or dont_inherit is not None: raise RuntimeError, "not implemented yet" - + if mode == "single": gen = Interactive(source, filename) elif mode == "exec": @@ -198,7 +198,7 @@ NameFinder, FunctionGen, and ClassGen. These attributes can be defined in the initClass() method, which is a hook for initializing these methods after all the classes have been - defined. + defined. """ optimized = 0 # is namespace access optimized? @@ -312,7 +312,7 @@ self.emit(prefix + '_NAME', name) def set_lineno(self, node, force=0): - """Emit SET_LINENO if node has lineno attribute and it is + """Emit SET_LINENO if node has lineno attribute and it is different than the last lineno emitted. Returns true if SET_LINENO was emitted. @@ -513,7 +513,7 @@ self.emit('CONTINUE_LOOP', loop_block) self.nextBlock() elif kind == END_FINALLY: - msg = "'continue' not allowed inside 'finally' clause (%s, %d)" + msg = "'continue' not allowed inside 'finally' clause (%s, %d)" raise SyntaxError, msg % (node.filename, node.lineno) def visitTest(self, node, jump): @@ -558,7 +558,7 @@ # list comprehensions __list_count = 0 - + def visitListComp(self, node): self.set_lineno(node) # setup list @@ -568,7 +568,7 @@ self.emit('DUP_TOP') self.emit('LOAD_ATTR', 'append') self._implicitNameOp('STORE', append) - + stack = [] for i, for_ in zip(range(len(node.quals)), node.quals): start, anchor = self.visit(for_) @@ -583,7 +583,7 @@ self.visit(node.expr) self.emit('CALL_FUNCTION', 1) self.emit('POP_TOP') - + for start, cont, anchor in stack: if cont: skip_one = self.newBlock() @@ -594,7 +594,7 @@ self.emit('JUMP_ABSOLUTE', start) self.startBlock(anchor) self._implicitNameOp('DELETE', append) - + self.__list_count = self.__list_count - 1 def visitListCompFor(self, node): @@ -675,7 +675,7 @@ self.setups.pop() self.emit('JUMP_FORWARD', lElse) self.startBlock(handlers) - + last = len(node.handlers) - 1 for i in range(len(node.handlers)): expr, target, body = node.handlers[i] @@ -707,7 +707,7 @@ self.nextBlock(lElse) self.visit(node.else_) self.nextBlock(end) - + def visitTryFinally(self, node): body = self.newBlock() final = self.newBlock() @@ -746,7 +746,7 @@ def visitName(self, node): self.set_lineno(node) self.loadName(node.name) - + def visitPass(self, node): self.set_lineno(node) @@ -1139,7 +1139,7 @@ __super_init = CodeGenerator.__init__ scopes = None - + def __init__(self, tree): self.graph = pyassem.PyFlowGraph("<module>", tree.filename) self.futures = future.find_futures(tree) @@ -1154,7 +1154,7 @@ scopes = None futures = () - + def __init__(self, tree): self.graph = pyassem.PyFlowGraph("<expression>", tree.filename) self.__super_init() @@ -1171,7 +1171,7 @@ scopes = None futures = () - + def __init__(self, tree): self.graph = pyassem.PyFlowGraph("<interactive>", tree.filename) self.__super_init() @@ -1201,8 +1201,8 @@ else: name = func.name args, hasTupleArg = generateArgList(func.argnames) - self.graph = pyassem.PyFlowGraph(name, func.filename, args, - optimized=1) + self.graph = pyassem.PyFlowGraph(name, func.filename, args, + optimized=1) self.isLambda = isLambda self.super_init() @@ -1234,7 +1234,7 @@ if type(arg) == types.TupleType: self.emit('LOAD_FAST', '.%d' % (i * 2)) self.unpackSequence(arg) - + def unpackSequence(self, tup): if VERSION > 1: self.emit('UNPACK_SEQUENCE', len(tup)) @@ -1249,7 +1249,7 @@ unpackTuple = unpackSequence class FunctionCodeGenerator(NestedScopeMixin, AbstractFunctionCode, - CodeGenerator): + CodeGenerator): super_init = CodeGenerator.__init__ # call be other init scopes = None
