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

Function _code_to_hash_pyc

Lib/importlib/_bootstrap_external.py:521–529  ·  view source on GitHub ↗

Produce the data for a hash-based pyc.

(code, source_hash, checked=True)

Source from the content-addressed store, hash-verified

519
520
521def _code_to_hash_pyc(code, source_hash, checked=True):
522 "Produce the data for a hash-based pyc."
523 data = bytearray(MAGIC_NUMBER)
524 flags = 0b1 | checked << 1
525 data.extend(_pack_uint32(flags))
526 assert len(source_hash) == 8
527 data.extend(source_hash)
528 data.extend(marshal.dumps(code))
529 return data
530
531
532def decode_source(source_bytes):

Callers 1

get_codeMethod · 0.85

Calls 3

_pack_uint32Function · 0.85
extendMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…