Skip to content

Commit 4b3d5b6

Browse files
authored
GH-119866: Don't clear frame->stackpointer on release builds (GH-131750)
1 parent 2c686a9 commit 4b3d5b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Include/internal/pycore_interpframe.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,17 @@ _PyFrame_GetLocalsArray(_PyInterpreterFrame *frame)
163163
return frame->localsplus;
164164
}
165165

166-
/* Fetches the stack pointer, and sets stackpointer to NULL.
167-
Having stackpointer == NULL ensures that invalid
168-
values are not visible to the cycle GC. */
166+
// Fetches the stack pointer, and (on debug builds) sets stackpointer to NULL.
167+
// Having stackpointer == NULL makes it easier to catch missing stack pointer
168+
// spills/restores (which could expose invalid values to the GC) using asserts.
169169
static inline _PyStackRef*
170170
_PyFrame_GetStackPointer(_PyInterpreterFrame *frame)
171171
{
172172
assert(frame->stackpointer != NULL);
173173
_PyStackRef *sp = frame->stackpointer;
174+
#ifndef NDEBUG
174175
frame->stackpointer = NULL;
176+
#endif
175177
return sp;
176178
}
177179

0 commit comments

Comments
 (0)
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