[3.9] gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373) (GH-99493)

This commit is contained in:
Steve Dower 2022-11-21 18:13:33 +00:00 committed by GitHub
parent c09dba57cf
commit 7b98207aa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 0 deletions

View file

@ -440,6 +440,8 @@ sys_addaudithook_impl(PyObject *module, PyObject *hook)
if (is->audit_hooks == NULL) {
return NULL;
}
/* Avoid having our list of hooks show up in the GC module */
PyObject_GC_UnTrack(is->audit_hooks);
}
if (PyList_Append(is->audit_hooks, hook) < 0) {