Compile bytecode as found in a pyc.
(data, name=None, bytecode_path=None, source_path=None)
| 507 | |
| 508 | |
| 509 | def _compile_bytecode(data, name=None, bytecode_path=None, source_path=None): |
| 510 | """Compile bytecode as found in a pyc.""" |
| 511 | code = marshal.loads(data) |
| 512 | if isinstance(code, _code_type): |
| 513 | _bootstrap._verbose_message('code object from {!r}', bytecode_path) |
| 514 | if source_path is not None: |
| 515 | _imp._fix_co_filename(code, source_path) |
| 516 | return code |
| 517 | else: |
| 518 | raise ImportError(f'Non-code object in {bytecode_path!r}', |
| 519 | name=name, path=bytecode_path) |
| 520 | |
| 521 | |
| 522 | def _code_to_timestamp_pyc(code, mtime=0, source_size=0): |
no test coverage detected