@@ -198,14 +198,17 @@ by another event:
198198
199199The :monitoring-event: `C_RETURN ` and :monitoring-event: `C_RAISE ` events
200200are controlled by the :monitoring-event: `CALL ` event.
201- :monitoring-event: `C_RETURN ` and :monitoring-event: `C_RAISE ` events will only be seen if the
202- corresponding :monitoring-event: `CALL ` event is being monitored.
201+ :monitoring-event: `C_RETURN ` and :monitoring-event: `C_RAISE ` events will only be
202+ seen if the corresponding :monitoring-event: `CALL ` event is being monitored.
203+
204+
205+ .. _monitoring-event-global :
203206
204207Other events
205208''''''''''''
206209
207210Other events are not necessarily tied to a specific location in the
208- program and cannot be individually disabled.
211+ program and cannot be individually disabled via :data: ` DISABLE ` .
209212
210213The other events that can be monitored are:
211214
@@ -264,12 +267,13 @@ in Python (see :ref:`c-api-monitoring`).
264267
265268.. function :: get_local_events(tool_id: int, code: CodeType, /) -> int
266269
267- Returns all the local events for *code *
270+ Returns all the :ref: ` local events < monitoring-event-local >` for *code *
268271
269272.. function :: set_local_events(tool_id: int, code: CodeType, event_set: int, /) -> None
270273
271- Activates all the local events for *code * which are set in *event_set *.
272- Raises a :exc: `ValueError ` if *tool_id * is not in use.
274+ Activates all the :ref: `local events <monitoring-event-local >` for *code *
275+ which are set in *event_set *. Raises a :exc: `ValueError ` if *tool_id * is not
276+ in use.
273277
274278Local events add to global events, but do not mask them.
275279In other words, all global events will trigger for a code object,
@@ -284,15 +288,21 @@ Disabling events
284288 A special value that can be returned from a callback function to disable
285289 events for the current code location.
286290
287- Local events can be disabled for a specific code location by returning
288- :data: `sys.monitoring.DISABLE ` from a callback function. This does not change
289- which events are set, or any other code locations for the same event.
291+ :ref: `Local events <monitoring-event-local >` can be disabled for a specific code
292+ location by returning :data: `sys.monitoring.DISABLE ` from a callback function.
293+ This does not change which events are set, or any other code locations for the
294+ same event.
290295
291296Disabling events for specific locations is very important for high
292297performance monitoring. For example, a program can be run under a
293298debugger with no overhead if the debugger disables all monitoring
294299except for a few breakpoints.
295300
301+ If :data: `DISABLE ` is returned by a callback for a
302+ :ref: `global event <monitoring-event-global >`, :exc: `ValueError ` will be raised
303+ by the interpreter in a non-specific location (that is, no traceback will be
304+ provided).
305+
296306.. function :: restart_events() -> None
297307
298308 Enable all the events that were disabled by :data: `sys.monitoring.DISABLE `
0 commit comments