mirror of https://github.com/python/cpython
satisfy the tabnanny
fix broken references to filename var in generateXXX methods
This commit is contained in:
parent
1e862e8a37
commit
873bdc18e4
|
@ -177,13 +177,12 @@ class CodeGenerator:
|
|||
|
||||
def _generateFunctionOrLambdaCode(self, func):
|
||||
self.name = func.name
|
||||
self.filename = filename
|
||||
|
||||
# keep a lookout for 'def foo((x,y)):'
|
||||
args, hasTupleArg = self.generateArglist(func.argnames)
|
||||
|
||||
self.code = PyAssembler(args=args, name=func.name,
|
||||
filename=filename)
|
||||
filename=self.filename)
|
||||
self.namespace = self.OPTIMIZED
|
||||
if func.varargs:
|
||||
self.code.setVarArgs()
|
||||
|
@ -239,7 +238,7 @@ class CodeGenerator:
|
|||
|
||||
def generateClassCode(self, klass):
|
||||
self.code = PyAssembler(name=klass.name,
|
||||
filename=filename)
|
||||
filename=self.filename)
|
||||
self.emit('SET_LINENO', klass.lineno)
|
||||
lnf = walk(klass.code, LocalNameFinder(), 0)
|
||||
self.locals.push(lnf.getLocals())
|
||||
|
@ -927,6 +926,12 @@ class CompiledModule:
|
|||
mtime = struct.pack('i', mtime)
|
||||
return magic + mtime
|
||||
|
||||
def compile(filename):
|
||||
buf = open(filename).read()
|
||||
mod = CompiledModule(buf, filename)
|
||||
mod.compile()
|
||||
mod.dump(filename + 'c')
|
||||
|
||||
if __name__ == "__main__":
|
||||
import getopt
|
||||
|
||||
|
@ -945,7 +950,4 @@ if __name__ == "__main__":
|
|||
for filename in args:
|
||||
if VERBOSE:
|
||||
print filename
|
||||
buf = open(filename).read()
|
||||
mod = CompiledModule(buf, filename)
|
||||
mod.compile()
|
||||
mod.dump(filename + 'c')
|
||||
compile(filename)
|
||||
|
|
|
@ -177,13 +177,12 @@ class CodeGenerator:
|
|||
|
||||
def _generateFunctionOrLambdaCode(self, func):
|
||||
self.name = func.name
|
||||
self.filename = filename
|
||||
|
||||
# keep a lookout for 'def foo((x,y)):'
|
||||
args, hasTupleArg = self.generateArglist(func.argnames)
|
||||
|
||||
self.code = PyAssembler(args=args, name=func.name,
|
||||
filename=filename)
|
||||
filename=self.filename)
|
||||
self.namespace = self.OPTIMIZED
|
||||
if func.varargs:
|
||||
self.code.setVarArgs()
|
||||
|
@ -239,7 +238,7 @@ class CodeGenerator:
|
|||
|
||||
def generateClassCode(self, klass):
|
||||
self.code = PyAssembler(name=klass.name,
|
||||
filename=filename)
|
||||
filename=self.filename)
|
||||
self.emit('SET_LINENO', klass.lineno)
|
||||
lnf = walk(klass.code, LocalNameFinder(), 0)
|
||||
self.locals.push(lnf.getLocals())
|
||||
|
@ -927,6 +926,12 @@ class CompiledModule:
|
|||
mtime = struct.pack('i', mtime)
|
||||
return magic + mtime
|
||||
|
||||
def compile(filename):
|
||||
buf = open(filename).read()
|
||||
mod = CompiledModule(buf, filename)
|
||||
mod.compile()
|
||||
mod.dump(filename + 'c')
|
||||
|
||||
if __name__ == "__main__":
|
||||
import getopt
|
||||
|
||||
|
@ -945,7 +950,4 @@ if __name__ == "__main__":
|
|||
for filename in args:
|
||||
if VERBOSE:
|
||||
print filename
|
||||
buf = open(filename).read()
|
||||
mod = CompiledModule(buf, filename)
|
||||
mod.compile()
|
||||
mod.dump(filename + 'c')
|
||||
compile(filename)
|
||||
|
|
Loading…
Reference in New Issue