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

Function gen_c_code

Tools/freeze/regen_frozen.py:25–40  ·  view source on GitHub ↗

Generate C code for the module code in 'co_bytes', write it to 'fp'.

(fp, co_bytes)

Source from the content-addressed store, hash-verified

23
24
25def gen_c_code(fp, co_bytes):
26 """Generate C code for the module code in 'co_bytes', write it to 'fp'.
27 """
28 def write(*args, **kwargs):
29 print(*args, **kwargs, file=fp)
30 write('/* Generated with Tools/freeze/regen_frozen.py */')
31 write('static unsigned char %s[] = {' % SYMBOL, end='')
32 bytes_per_row = 13
33 for i, opcode in enumerate(co_bytes):
34 if (i % bytes_per_row) == 0:
35 # start a new row
36 write()
37 write(' ', end='')
38 write('%d,' % opcode, end='')
39 write()
40 write('};')
41
42
43def main():

Callers 1

mainFunction · 0.85

Calls 2

enumerateFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…