From 7b432e3523d91d32e602dd372093907557dab3f0 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 25 Mar 2025 11:12:39 -0700 Subject: [PATCH 1/2] Don't set the stack pointer to NULL on release builds --- Include/internal/pycore_interpframe.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Include/internal/pycore_interpframe.h b/Include/internal/pycore_interpframe.h index 097da4edee1aaf..dc803332eaf8fd 100644 --- a/Include/internal/pycore_interpframe.h +++ b/Include/internal/pycore_interpframe.h @@ -171,7 +171,9 @@ _PyFrame_GetStackPointer(_PyInterpreterFrame *frame) { assert(frame->stackpointer != NULL); _PyStackRef *sp = frame->stackpointer; +#ifndef NDEBUG frame->stackpointer = NULL; +#endif return sp; } From a0c76fd0219223d775f61796da17e67049bf4f97 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 26 Mar 2025 11:32:15 -0700 Subject: [PATCH 2/2] Update comment --- Include/internal/pycore_interpframe.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Include/internal/pycore_interpframe.h b/Include/internal/pycore_interpframe.h index dc803332eaf8fd..1d373d55ab2de8 100644 --- a/Include/internal/pycore_interpframe.h +++ b/Include/internal/pycore_interpframe.h @@ -163,9 +163,9 @@ _PyFrame_GetLocalsArray(_PyInterpreterFrame *frame) return frame->localsplus; } -/* Fetches the stack pointer, and sets stackpointer to NULL. - Having stackpointer == NULL ensures that invalid - values are not visible to the cycle GC. */ +// Fetches the stack pointer, and (on debug builds) sets stackpointer to NULL. +// Having stackpointer == NULL makes it easier to catch missing stack pointer +// spills/restores (which could expose invalid values to the GC) using asserts. static inline _PyStackRef* _PyFrame_GetStackPointer(_PyInterpreterFrame *frame) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy