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

This commit is contained in:
Steve Dower 2022-11-14 21:39:18 +00:00 committed by GitHub
parent 3d9431983a
commit 4e4b13e8f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 0 deletions

View file

@ -450,6 +450,17 @@ def test_syslog():
syslog.closelog()
def test_not_in_gc():
import gc
hook = lambda *a: None
sys.addaudithook(hook)
for o in gc.get_objects():
if isinstance(o, list):
assert hook not in o
if __name__ == "__main__":
from test.support import suppress_msvcrt_asserts