Compile bytecode as found in a pyc.
(data, name=None, bytecode_path=None, source_path=None)
| 496 | |
| 497 | |
| 498 | def _compile_bytecode(data, name=None, bytecode_path=None, source_path=None): |
| 499 | """Compile bytecode as found in a pyc.""" |
| 500 | code = marshal.loads(data) |
| 501 | if isinstance(code, _code_type): |
| 502 | _bootstrap._verbose_message('code object from {!r}', bytecode_path) |
| 503 | if source_path is not None: |
| 504 | _imp._fix_co_filename(code, source_path) |
| 505 | return code |
| 506 | else: |
| 507 | raise ImportError(f'Non-code object in {bytecode_path!r}', |
| 508 | name=name, path=bytecode_path) |
| 509 | |
| 510 | |
| 511 | def _code_to_timestamp_pyc(code, mtime=0, source_size=0): |