Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import marshal
import sys
WATCHED = {"compile", "code.__new__"}
def audit_hook(event, args):
if event in WATCHED:
raise RuntimeError(f"blocked {event}")