bpo-36842: Implement PEP 578 (GH-12613)
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index d2b2761..7219f54 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1091,6 +1091,12 @@
co = PyAST_CompileObject(mod, filename, flags, -1, arena);
if (co == NULL)
return NULL;
+
+ if (PySys_Audit("exec", "O", co) < 0) {
+ Py_DECREF(co);
+ return NULL;
+ }
+
v = run_eval_code_obj(co, globals, locals);
Py_DECREF(co);
return v;