File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -163,15 +163,17 @@ _PyFrame_GetLocalsArray(_PyInterpreterFrame *frame)
163
163
return frame -> localsplus ;
164
164
}
165
165
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.
169
169
static inline _PyStackRef *
170
170
_PyFrame_GetStackPointer (_PyInterpreterFrame * frame )
171
171
{
172
172
assert (frame -> stackpointer != NULL );
173
173
_PyStackRef * sp = frame -> stackpointer ;
174
+ #ifndef NDEBUG
174
175
frame -> stackpointer = NULL ;
176
+ #endif
175
177
return sp ;
176
178
}
177
179
You can’t perform that action at this time.
0 commit comments