mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
gh-108294: Add time.sleep audit event (GH-108298)
This commit is contained in:
parent
2dfbd4f36d
commit
31b61d19ab
5 changed files with 38 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue