module documentation

Python version numbers and their encoding ("magic number").

Function magic_word_to_version Return the Python version belonging to the magic number in the pyc head.
Constant PYTHON_MAGIC Undocumented
def magic_word_to_version(magic_word): (source)

Return the Python version belonging to the magic number in the pyc head. The magic number is encoded in the first two bytes of a .pyc file. It translates to a (major, minor) version. It never has a "micro" version, because Python bytecode encoding doesn't change between micro version. Arguments: magic_word: A 16 bit number, either as an integer or little-endian encoded as a string. Returns: A tuple (major, minor), e.g. (3, 7).

PYTHON_MAGIC: dict = (source)

Undocumented

Value
{20121: (1, 5),
 50428: (1, 6),
 50823: (2, 0),
 60202: (2, 1),
 60717: (2, 2),
 62011: (2, 3),
 62021: (2, 3),
...