@@ -216,14 +216,17 @@ by another event:
216216
217217The :monitoring-event: `C_RETURN ` and :monitoring-event: `C_RAISE ` events
218218are controlled by the :monitoring-event: `CALL ` event.
219- :monitoring-event: `C_RETURN ` and :monitoring-event: `C_RAISE ` events will only be seen if the
220- corresponding :monitoring-event: `CALL ` event is being monitored.
219+ :monitoring-event: `C_RETURN ` and :monitoring-event: `C_RAISE ` events will only be
220+ seen if the corresponding :monitoring-event: `CALL ` event is being monitored.
221+
222+
223+ .. _monitoring-event-global :
221224
222225Other events
223226''''''''''''
224227
225228Other events are not necessarily tied to a specific location in the
226- program and cannot be individually disabled.
229+ program and cannot be individually disabled via :data: ` DISABLE ` .
227230
228231The other events that can be monitored are:
229232
@@ -289,12 +292,13 @@ in Python (see :ref:`c-api-monitoring`).
289292
290293.. function :: get_local_events(tool_id: int, code: CodeType, /) -> int
291294
292- Returns all the local events for *code *
295+ Returns all the :ref: ` local events < monitoring-event-local >` for *code *
293296
294297.. function :: set_local_events(tool_id: int, code: CodeType, event_set: int, /) -> None
295298
296- Activates all the local events for *code * which are set in *event_set *.
297- Raises a :exc: `ValueError ` if *tool_id * is not in use.
299+ Activates all the :ref: `local events <monitoring-event-local >` for *code *
300+ which are set in *event_set *. Raises a :exc: `ValueError ` if *tool_id * is not
301+ in use.
298302
299303
300304Disabling events
@@ -305,15 +309,21 @@ Disabling events
305309 A special value that can be returned from a callback function to disable
306310 events for the current code location.
307311
308- Local events can be disabled for a specific code location by returning
309- :data: `sys.monitoring.DISABLE ` from a callback function. This does not change
310- which events are set, or any other code locations for the same event.
312+ :ref: `Local events <monitoring-event-local >` can be disabled for a specific code
313+ location by returning :data: `sys.monitoring.DISABLE ` from a callback function.
314+ This does not change which events are set, or any other code locations for the
315+ same event.
311316
312317Disabling events for specific locations is very important for high
313318performance monitoring. For example, a program can be run under a
314319debugger with no overhead if the debugger disables all monitoring
315320except for a few breakpoints.
316321
322+ If :data: `DISABLE ` is returned by a callback for a
323+ :ref: `global event <monitoring-event-global >`, :exc: `ValueError ` will be raised
324+ by the interpreter in a non-specific location (that is, no traceback will be
325+ provided).
326+
317327.. function :: restart_events() -> None
318328
319329 Enable all the events that were disabled by :data: `sys.monitoring.DISABLE `
0 commit comments