summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-09-05 11:29:38 (GMT)
committerGitHub <noreply@github.com>2023-09-05 11:29:38 (GMT)
commit7ee021f99998690ee724d08a95dceadd2ec8a051 (patch)
tree6b1b3d3baae57c46b3a56ce0645661e0568de46e /Include/cpython
parent5121faabd1b3733a1198a18fa5df540eeb2475f6 (diff)
downloadcpython-7ee021f99998690ee724d08a95dceadd2ec8a051.zip
cpython-7ee021f99998690ee724d08a95dceadd2ec8a051.tar.gz
cpython-7ee021f99998690ee724d08a95dceadd2ec8a051.tar.bz2
[3.12] GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420) (#108899)
* GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420) * Restore generated objects * Restore size of monitoring arrays in code object for 3.12 ABI compatibility. * Update ABI file
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/code.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index 565b394..03834b2 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -8,16 +8,23 @@
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. */
+/* For 3.12 ABI compatibility this is over sized */
+typedef struct _Py_LocalMonitors {
+ /* Only _PY_MONITORING_LOCAL_EVENTS of these are used */
+ uint8_t tools[_PY_MONITORING_UNGROUPED_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
@@ -81,9 +88,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 */