Skip to content

Commit 7cce26b

Browse files
miss-islingtongaogaotiantianAlexWaygood
authored
[3.12] Docs: Add restart_events() and positional arg semantics for sys.monitoring (GH-111291) (#111335)
Docs: Add `restart_events()` and positional arg semantics for `sys.monitoring` (GH-111291) (cherry picked from commit 3f84a19) Co-authored-by: Tian Gao <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent 3641dae commit 7cce26b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Doc/library/sys.monitoring.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ Identifiers are integers in the range 0 to 5 inclusive.
4444
Registering and using tools
4545
'''''''''''''''''''''''''''
4646

47-
.. function:: use_tool_id(tool_id: int, name: str) -> None
47+
.. function:: use_tool_id(tool_id: int, name: str, /) -> None
4848

4949
Must be called before *tool_id* can be used.
5050
*tool_id* must be in the range 0 to 5 inclusive.
5151
Raises a :exc:`ValueError` if *tool_id* is in use.
5252

53-
.. function:: free_tool_id(tool_id: int) -> None
53+
.. function:: free_tool_id(tool_id: int, /) -> None
5454

5555
Should be called once a tool no longer requires *tool_id*.
5656

57-
.. function:: get_tool(tool_id: int) -> str | None
57+
.. function:: get_tool(tool_id: int, /) -> str | None
5858

5959
Returns the name of the tool if *tool_id* is in use,
6060
otherwise it returns ``None``.
@@ -237,11 +237,11 @@ Setting events globally
237237

238238
Events can be controlled globally by modifying the set of events being monitored.
239239

240-
.. function:: get_events(tool_id: int) -> int
240+
.. function:: get_events(tool_id: int, /) -> int
241241

242242
Returns the ``int`` representing all the active events.
243243

244-
.. function:: set_events(tool_id: int, event_set: int)
244+
.. function:: set_events(tool_id: int, event_set: int, /) -> None
245245

246246
Activates all events which are set in *event_set*.
247247
Raises a :exc:`ValueError` if *tool_id* is not in use.
@@ -253,11 +253,11 @@ Per code object events
253253

254254
Events can also be controlled on a per code object basis.
255255

256-
.. function:: get_local_events(tool_id: int, code: CodeType) -> int
256+
.. function:: get_local_events(tool_id: int, code: CodeType, /) -> int
257257

258258
Returns all the local events for *code*
259259

260-
.. function:: set_local_events(tool_id: int, code: CodeType, event_set: int)
260+
.. function:: set_local_events(tool_id: int, code: CodeType, event_set: int, /) -> None
261261

262262
Activates all the local events for *code* which are set in *event_set*.
263263
Raises a :exc:`ValueError` if *tool_id* is not in use.
@@ -284,6 +284,11 @@ performance monitoring. For example, a program can be run under a
284284
debugger with no overhead if the debugger disables all monitoring
285285
except for a few breakpoints.
286286

287+
.. function:: restart_events() -> None
288+
289+
Enable all the events that were disabled by :data:`sys.monitoring.DISABLE`
290+
for all tools.
291+
287292

288293
.. _callbacks:
289294

@@ -292,7 +297,7 @@ Registering callback functions
292297

293298
To register a callable for events call
294299

295-
.. function:: register_callback(tool_id: int, event: int, func: Callable | None) -> Callable | None
300+
.. function:: register_callback(tool_id: int, event: int, func: Callable | None, /) -> Callable | None
296301

297302
Registers the callable *func* for the *event* with the given *tool_id*
298303

0 commit comments

Comments
 (0)