MCPcopy Index your code
hub / github.com/nodejs/node / load_bytecode

Method load_bytecode

tools/inspector_protocol/jinja2/bccache.py:79–96  ·  view source on GitHub ↗

Loads bytecode from a file or file like object.

(self, f)

Source from the content-addressed store, hash-verified

77 self.code = None
78
79 def load_bytecode(self, f):
80 """Loads bytecode from a file or file like object."""
81 # make sure the magic header is correct
82 magic = f.read(len(bc_magic))
83 if magic != bc_magic:
84 self.reset()
85 return
86 # the source code of the file changed, we need to reload
87 checksum = pickle.load(f)
88 if self.checksum != checksum:
89 self.reset()
90 return
91 # if marshal_load fails then we need to reload
92 try:
93 self.code = marshal_load(f)
94 except (EOFError, ValueError, TypeError):
95 self.reset()
96 return
97
98 def write_bytecode(self, f):
99 """Dump the bytecode into the file or file like object passed."""

Callers 2

bytecode_from_stringMethod · 0.95
load_bytecodeMethod · 0.45

Calls 4

resetMethod · 0.95
marshal_loadFunction · 0.85
readMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected