Skip to main content

hlrun.patch

A Python-based system for patching and hooking of bytecode, similar to DCCM.

class Patch

Runtime stub version of the Patch class. Maintains API compatibility but provides no patching functionality in runtime mode.

name

name = name

author

author = author

sha256

sha256 = sha256

interceptions: Dict[str | int, Callable[[Args], Args]]

interceptions = {}

patches: Dict[str | int, Callable[[Bytecode, Function], None]]

patches = {}

init

def __init__(name: Optional[str] = None, author: Optional[str] = None, sha256: Optional[str] = None)

Initialize a new patch (runtime stub).

intercept

def intercept(fn: str | int) -> Callable[[Callable[[Args], Args]], Callable[[Args], Args]]

Intercept (and modify arguments to) function calls at runtime.

patch

def patch(fn: str | int) -> Callable[[Callable[[object, object], None]], Callable[[object, object], None]]

Patch bytecode statically before runtime.

apply

def apply(code: object) -> None

Runtime stub for applying patches.

do_intercept

def do_intercept(args: Args, identifier: str | int) -> Args

Runtime handler for interception. The only function in this runtime class that does something!

T

T = TypeVar('T')
USE_CRASHLINK = False