gh-108294: Add time.sleep audit event (GH-108298)

This commit is contained in:
Petr Viktorin 2023-08-23 11:00:22 +02:00 committed by GitHub
parent 2dfbd4f36d
commit 31b61d19ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 0 deletions

View file

@ -514,6 +514,21 @@ def test_not_in_gc():
assert hook not in o
def test_time():
import time
def hook(event, args):
if event.startswith("time."):
print(event, *args)
sys.addaudithook(hook)
time.sleep(0)
time.sleep(0.0625) # 1/16, a small exact float
try:
time.sleep(-1)
except ValueError:
pass
def test_sys_monitoring_register_callback():
import sys