From 4e4b13e8f6211abbc0d53056da11357756daa314 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 14 Nov 2022 21:39:18 +0000 Subject: gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373) --- Python/sysmodule.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 1090b124fea..6f0a126a622 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -431,6 +431,8 @@ sys_addaudithook_impl(PyObject *module, PyObject *hook) if (interp->audit_hooks == NULL) { return NULL; } + /* Avoid having our list of hooks show up in the GC module */ + PyObject_GC_UnTrack(interp->audit_hooks); } if (PyList_Append(interp->audit_hooks, hook) < 0) { -- cgit v1.2.3