Пример #1
0
 def _init(self):
     visitor, info, flags, const = self.visitorStack[-1]
     visitor.visitCode(info.getArgumentCount(),
                       info.getLocalsCount(),
                       info.getMaxStackSize(),
                       CompilerFlag.toBitFlags(flags),
                       [], # constants
                       const._names,
                       const._varnames,
                       const._freevars,
                       const._cellvars,
                       info.getFilename(), info.getName(),
                       0) # first line number
Пример #2
0
 def _init(self):
     visitor, info, flags, const = self.visitorStack[-1]
     visitor.visitCode(
         info.getArgumentCount(),
         info.getLocalsCount(),
         info.getMaxStackSize(),
         CompilerFlag.toBitFlags(flags),
         [],  # constants
         const._names,
         const._varnames,
         const._freevars,
         const._cellvars,
         info.getFilename(),
         info.getName(),
         0)  # first line number
Пример #3
0
    def load_code(self):
        # FIXME: control flow in this function is ugly
        # this is due to the marshal format of code objects,
        # and the requirements of the old PBC compiler in the pyasm module,
        # these are still enforeced upon us as long as we use the adapter mod.
        oldBundle = self.__bundle
        try:
            if self.__bundle is None:
                self.__bundle = Bundle()
            bundle = self.__bundle

            store = Constants()
            info = BytecodeInfo()

            info._argcount = self.read_long()
            info._nlocals = self.read_long()
            info._stacksize = self.read_long()
            flags = self.read_long()

            compiler = bundle.compile("???SIGNATURE???", info,
                                      CompilerFlag.parseFlags(flags), False)
            code = self.load()
            store.constants(self.load())
            store.names(self.load())
            store.varnames(self.load())
            store.freevars(self.load())
            store.cellvars(self.load())
            info._filename = self.load()
            info._name = self.load()
            firstlineno = self.read_long()
            lnotab = self.load()

            bundle._init()

            lines = LineNumberBuilder(firstlineno, lnotab)
            resolver = ReferenceResolver(self.version, store, _Reader(code),
                                         lines)

            resolver.accept(compiler)

            return bundle.loadHandle(None)
        finally:
            self.__bundle = oldBundle
Пример #4
0
    def load_code(self):
        # FIXME: control flow in this function is ugly
        # this is due to the marshal format of code objects,
        # and the requirements of the old PBC compiler in the pyasm module,
        # these are still enforeced upon us as long as we use the adapter mod.
        oldBundle = self.__bundle
        try:
            if self.__bundle is None:
                self.__bundle = Bundle()
            bundle = self.__bundle

            store = Constants()
            info = BytecodeInfo()

            info._argcount = self.read_long()
            info._nlocals = self.read_long()
            info._stacksize = self.read_long()
            flags = self.read_long()

            compiler = bundle.compile("???SIGNATURE???", info,
                                      CompilerFlag.parseFlags(flags), False)
            code = self.load()
            store.constants( self.load() )
            store.names( self.load() )
            store.varnames( self.load() )
            store.freevars( self.load() )
            store.cellvars( self.load() )
            info._filename = self.load()
            info._name = self.load()
            firstlineno = self.read_long()
            lnotab = self.load()

            bundle._init()

            lines = LineNumberBuilder(firstlineno, lnotab)
            resolver = ReferenceResolver(self.version,store,_Reader(code),lines)

            resolver.accept(compiler)

            return bundle.loadHandle(None)
        finally:
            self.__bundle = oldBundle