diff options
author | Mark Shannon <mark@hotpy.org> | 2023-09-05 07:03:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 07:03:53 (GMT) |
commit | 5a2a04615171899885b977d77dc379bd78bac87f (patch) | |
tree | 07b3b359d819e917cca725ca787734bad8735387 /Include/cpython | |
parent | 04a0830b00879efe057e3dfe75e9aa9c0caf1a26 (diff) | |
download | cpython-5a2a04615171899885b977d77dc379bd78bac87f.zip cpython-5a2a04615171899885b977d77dc379bd78bac87f.tar.gz cpython-5a2a04615171899885b977d77dc379bd78bac87f.tar.bz2 |
GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420)
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/code.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h index 24c5ec2..45b09a1 100644 --- a/Include/cpython/code.h +++ b/Include/cpython/code.h @@ -8,16 +8,21 @@ extern "C" { #endif - +/* Count of all local monitoring events */ +#define _PY_MONITORING_LOCAL_EVENTS 10 /* Count of all "real" monitoring events (not derived from other events) */ #define _PY_MONITORING_UNGROUPED_EVENTS 15 /* Count of all monitoring events */ #define _PY_MONITORING_EVENTS 17 -/* Table of which tools are active for each monitored event. */ -typedef struct _Py_Monitors { +/* Tables of which tools are active for each monitored event. */ +typedef struct _Py_LocalMonitors { + uint8_t tools[_PY_MONITORING_LOCAL_EVENTS]; +} _Py_LocalMonitors; + +typedef struct _Py_GlobalMonitors { uint8_t tools[_PY_MONITORING_UNGROUPED_EVENTS]; -} _Py_Monitors; +} _Py_GlobalMonitors; /* Each instruction in a code object is a fixed-width value, * currently 2 bytes: 1-byte opcode + 1-byte oparg. The EXTENDED_ARG @@ -88,9 +93,9 @@ typedef struct { */ typedef struct { /* Monitoring specific to this code object */ - _Py_Monitors local_monitors; + _Py_LocalMonitors local_monitors; /* Monitoring that is active on this code object */ - _Py_Monitors active_monitors; + _Py_LocalMonitors active_monitors; /* The tools that are to be notified for events for the matching code unit */ uint8_t *tools; /* Information to support line events */ |