From 9fe59975a13dabaa7e0cea636b14984d0a27f769 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Thu, 17 Jul 2025 11:10:10 -0700 Subject: [PATCH 1/3] [3.13] gh-136697: Use the standard audit event format for sys.monitoring docs (GH-136747) (cherry picked from commit 28937d3a21cf8168c853ae43374a8287c21f71c9) Co-authored-by: Tian Gao --- Doc/library/sys.monitoring.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/sys.monitoring.rst b/Doc/library/sys.monitoring.rst index d43b4742569d71..b343bd090de6ef 100644 --- a/Doc/library/sys.monitoring.rst +++ b/Doc/library/sys.monitoring.rst @@ -314,13 +314,17 @@ To register a callable for events call it is unregistered and returned. Otherwise :func:`register_callback` returns ``None``. + .. audit-event:: sys.monitoring.register_callback func sys.monitoring.register_callback Functions can be unregistered by calling ``sys.monitoring.register_callback(tool_id, event, None)``. Callback functions can be registered and unregistered at any time. -Registering or unregistering a callback function will generate a :func:`sys.audit` event. +Callbacks are called only once regardless if the event is turned on both +globally and locally. As such, if an event could be turned on for both global +and local events by your code then the callback needs to be written to handle +either trigger. Callback function arguments From ce6bd414121f011bea1c114eca0c9ae033b4c575 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Thu, 17 Jul 2025 11:25:31 -0700 Subject: [PATCH 2/3] Update sys.monitoring.rst --- Doc/library/sys.monitoring.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Doc/library/sys.monitoring.rst b/Doc/library/sys.monitoring.rst index b343bd090de6ef..1325a6de5f0f22 100644 --- a/Doc/library/sys.monitoring.rst +++ b/Doc/library/sys.monitoring.rst @@ -319,13 +319,6 @@ To register a callable for events call Functions can be unregistered by calling ``sys.monitoring.register_callback(tool_id, event, None)``. -Callback functions can be registered and unregistered at any time. - -Callbacks are called only once regardless if the event is turned on both -globally and locally. As such, if an event could be turned on for both global -and local events by your code then the callback needs to be written to handle -either trigger. - Callback function arguments ''''''''''''''''''''''''''' From 9a40d1785d23e2bf1e5010f80dfe20e3459e1974 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Thu, 17 Jul 2025 11:26:02 -0700 Subject: [PATCH 3/3] Update sys.monitoring.rst --- Doc/library/sys.monitoring.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/sys.monitoring.rst b/Doc/library/sys.monitoring.rst index 1325a6de5f0f22..8fdddbb7bfea81 100644 --- a/Doc/library/sys.monitoring.rst +++ b/Doc/library/sys.monitoring.rst @@ -319,6 +319,8 @@ To register a callable for events call Functions can be unregistered by calling ``sys.monitoring.register_callback(tool_id, event, None)``. +Callback functions can be registered and unregistered at any time. + Callback function arguments '''''''''''''''''''''''''''