我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用jinja2._compat.pickle.load()。
def load_bytecode(self, f): """Loads bytecode from a file or file like object.""" # make sure the magic header is correct magic = f.read(len(bc_magic)) if magic != bc_magic: self.reset() return # the source code of the file changed, we need to reload checksum = pickle.load(f) if self.checksum != checksum: self.reset() return # if marshal_load fails then we need to reload try: self.code = marshal_load(f) except (EOFError, ValueError, TypeError): self.reset() return