MCPcopy Index your code
hub / github.com/python/cpython / get_module_code

Function get_module_code

Tools/freeze/regen_frozen.py:14–22  ·  view source on GitHub ↗

Compile 'filename' and return the module code as a marshalled byte string.

(filename)

Source from the content-addressed store, hash-verified

12
13
14def get_module_code(filename):
15 """Compile 'filename' and return the module code as a marshalled byte
16 string.
17 """
18 with open(filename, 'r') as fp:
19 src = fp.read()
20 co = compile(src, 'none', 'exec')
21 co_bytes = marshal.dumps(co)
22 return co_bytes
23
24
25def gen_c_code(fp, co_bytes):

Callers 1

mainFunction · 0.85

Calls 4

openFunction · 0.70
compileFunction · 0.50
readMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…