MCPcopy Index your code
hub / github.com/RustPython/RustPython / _validate_timestamp_pyc

Function _validate_timestamp_pyc

Lib/importlib/_bootstrap_external.py:457–482  ·  view source on GitHub ↗

Validate a pyc against the source last-modified time. *data* is the contents of the pyc file. (Only the first 16 bytes are required.) *source_mtime* is the last modified timestamp of the source file. *source_size* is None or the size of the source file in bytes. *name* is the

(data, source_mtime, source_size, name,
                            exc_details)

Source from the content-addressed store, hash-verified

455
456
457def _validate_timestamp_pyc(data, source_mtime, source_size, name,
458 exc_details):
459 """Validate a pyc against the source last-modified time.
460
461 *data* is the contents of the pyc file. (Only the first 16 bytes are
462 required.)
463
464 *source_mtime* is the last modified timestamp of the source file.
465
466 *source_size* is None or the size of the source file in bytes.
467
468 *name* is the name of the module being imported. It is used for logging.
469
470 *exc_details* is a dictionary passed to ImportError if it raised for
471 improved debugging.
472
473 An ImportError is raised if the bytecode is stale.
474
475 """
476 if _unpack_uint32(data[8:12]) != (source_mtime & 0xFFFFFFFF):
477 message = f'bytecode is stale for {name!r}'
478 _bootstrap._verbose_message('{}', message)
479 raise ImportError(message, **exc_details)
480 if (source_size is not None and
481 _unpack_uint32(data[12:16]) != (source_size & 0xFFFFFFFF)):
482 raise ImportError(f'bytecode is stale for {name!r}', **exc_details)
483
484
485def _validate_hash_pyc(data, source_hash, name, exc_details):

Callers 1

get_codeMethod · 0.70

Calls 1

_unpack_uint32Function · 0.70

Tested by

no test coverage detected