From fd4f8f4cda59bb4eb3346419881cc2aa39f5f578 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 1 Oct 2026 12:54:58 -0400 Subject: [PATCH] gh-158572: Add an external flag to interpreter frames Adds an `external` flag to a bit-packed byte on the _PyInterpreterFrame struct in order to provide external frame evaluators a way to distinguish VM-pushed frames vs externally- pushed frames. --- Include/internal/pycore_interpframe_structs.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Include/internal/pycore_interpframe_structs.h b/Include/internal/pycore_interpframe_structs.h index 560fb66a97fc89..0d6a37cc2c1a17 100644 --- a/Include/internal/pycore_interpframe_structs.h +++ b/Include/internal/pycore_interpframe_structs.h @@ -42,12 +42,11 @@ struct _PyInterpreterFrame { #endif uint16_t return_offset; /* Only relevant during a function call */ char owner; -#ifdef Py_DEBUG uint8_t visited:1; + uint8_t external:1; /* Set when the frame was pushed by something other than the VM */ +#ifdef Py_DEBUG uint8_t stackpointer_valid:1; - uint8_t lltrace:6; -#else - uint8_t visited; + uint8_t lltrace:5; #endif /* Locals and stack */ _PyStackRef localsplus[1];