module documentation

Functions for generating, reading and parsing pyc.

Class AdjustFilename Visitor for changing co_filename in a code object.
Function compile_src Compile a string to pyc, and then load and parse the pyc.
Function parse_pyc_stream Parse pyc data from a file.
Function parse_pyc_string Parse pyc data from a string.
Function visit Recursively process constants in a pyc using a visitor.
Constant _VISIT_CACHE Undocumented
def compile_src(src, filename, python_version, python_exe, mode='exec'): (source)

Compile a string to pyc, and then load and parse the pyc. Args: src: Python source code. filename: The filename the sourcecode is from. python_version: Python version, (major, minor). python_exe: The path to Python interpreter. mode: "exec", "eval" or "single". Returns: An instance of loadmarshal.CodeType. Raises: UsageError: If python_exe and python_version are mismatched.

def parse_pyc_stream(fi): (source)

Parse pyc data from a file. Args: fi: A file-like object. Returns: An instance of loadmarshal.CodeType. Raises: IOError: If we can't read the file or the file is malformed.

def parse_pyc_string(data): (source)

Parse pyc data from a string. Args: data: pyc data Returns: An instance of loadmarshal.CodeType.

def visit(c, visitor): (source)

Recursively process constants in a pyc using a visitor.

_VISIT_CACHE: dict = (source)

Undocumented

Value
{}