https://github.com/python/cpython/commit/3dfa2557358f55c3836ee2ec5415018d06d3f3c1
commit: 3dfa2557358f55c3836ee2ec5415018d06d3f3c1
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-09-14T22:05:15+03:00
summary:

[3.15] gh-116750: Document 3.14 changes around sys.monitoring.clear_tool_id 
(GH-156706) (#157482)

Co-authored-by: Christian Neumüller <[email protected]>
Co-authored-by: Ned Batchelder <[email protected]>

files:
M Doc/library/sys.monitoring.rst
M Doc/whatsnew/3.14.rst

diff --git a/Doc/library/sys.monitoring.rst b/Doc/library/sys.monitoring.rst
index 7cca6f2bcdae912..0a653506b3d4959 100644
--- a/Doc/library/sys.monitoring.rst
+++ b/Doc/library/sys.monitoring.rst
@@ -54,11 +54,18 @@ Registering and using tools
 
    Unregister all events and callback functions associated with *tool_id*.
 
+   .. versionadded:: 3.14
+
 .. function:: free_tool_id(tool_id: int, /) -> None
 
    Should be called once a tool no longer requires *tool_id*.
    Will call :func:`clear_tool_id` before releasing *tool_id*.
 
+   .. versionchanged:: 3.14
+      Now calls :func:`clear_tool_id` before releasing *tool_id*.
+      Previously, it would not disable global or local events associated
+      with *tool_id*, nor unregister any callback functions.
+
 .. function:: get_tool(tool_id: int, /) -> str | None
 
    Returns the name of the tool if *tool_id* is in use,
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 8258ba93213bc45..617bdcb521833fa 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -1906,6 +1906,12 @@ sys.monitoring
   These replace and deprecate the :monitoring-event:`!BRANCH` event.
   (Contributed by Mark Shannon in :gh:`122548`.)
 
+* Add :func:`sys.monitoring.clear_tool_id` to unregister all events and
+  callback functions associated with a tool identifier.
+  :func:`sys.monitoring.free_tool_id` now calls it before releasing the
+  tool identifier, instead of leaving its events and callbacks registered.
+  (Contributed by Tian Gao in :gh:`116750`.)
+
 
 sysconfig
 ---------

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to