https://github.com/python/cpython/commit/4b3d5b604210f68005ef64d5346ca169385f5acf commit: 4b3d5b604210f68005ef64d5346ca169385f5acf branch: main author: Brandt Bucher <brandtbuc...@microsoft.com> committer: brandtbucher <brandtbuc...@gmail.com> date: 2025-03-26T19:00:16Z summary:
GH-119866: Don't clear frame->stackpointer on release builds (GH-131750) files: M Include/internal/pycore_interpframe.h diff --git a/Include/internal/pycore_interpframe.h b/Include/internal/pycore_interpframe.h index 097da4edee1aaf..1d373d55ab2de8 100644 --- a/Include/internal/pycore_interpframe.h +++ b/Include/internal/pycore_interpframe.h @@ -163,15 +163,17 @@ _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) { assert(frame->stackpointer != NULL); _PyStackRef *sp = frame->stackpointer; +#ifndef NDEBUG frame->stackpointer = NULL; +#endif return sp; } _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com