Skip to content

Commit 3133425

Browse files
committed
gh-116750: Document versionadded/versionchanged for sys.monitoring tool_id functions
clear_tool_id() was added in 3.14 but lacked a versionadded note, and free_tool_id()'s behavior change (now calling clear_tool_id() before releasing the tool_id, rather than leaving events/callbacks registered) was undocumented. Also add a What's New in 3.14 entry for both.
1 parent 03503dc commit 3133425

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Doc/library/sys.monitoring.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,18 @@ Registering and using tools
5454

5555
Unregister all events and callback functions associated with *tool_id*.
5656

57+
.. versionadded:: 3.14
58+
5759
.. function:: free_tool_id(tool_id: int, /) -> None
5860

5961
Should be called once a tool no longer requires *tool_id*.
6062
Will call :func:`clear_tool_id` before releasing *tool_id*.
6163

64+
.. versionchanged:: 3.14
65+
Now calls :func:`clear_tool_id` before releasing *tool_id*.
66+
Previously, it would not disable global or local events associated
67+
with *tool_id*, nor unregister any callback functions.
68+
6269
.. function:: get_tool(tool_id: int, /) -> str | None
6370

6471
Returns the name of the tool if *tool_id* is in use,

Doc/whatsnew/3.14.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,12 @@ sys.monitoring
19061906
These replace and deprecate the :monitoring-event:`!BRANCH` event.
19071907
(Contributed by Mark Shannon in :gh:`122548`.)
19081908

1909+
* Add :func:`sys.monitoring.clear_tool_id` to unregister all events and
1910+
callback functions associated with a tool identifier.
1911+
:func:`sys.monitoring.free_tool_id` now calls it before releasing the
1912+
tool identifier, instead of leaving its events and callbacks registered.
1913+
(Contributed by Tian Gao in :gh:`116750`.)
1914+
19091915

19101916
sysconfig
19111917
---------

0 commit comments

Comments
 (0)