Compile 'filename' and return the module code as a marshalled byte string.
(filename)
| 12 | |
| 13 | |
| 14 | def 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 | |
| 25 | def gen_c_code(fp, co_bytes): |