Skip to content

Commit d258fe5

Browse files
authored
Merge branch 'main' into obmalloc
2 parents 116b29b + fbfc6cc commit d258fe5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Include/internal/pycore_interpframe.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ static inline void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *
149149
int stacktop = (int)(src->stackpointer - src->localsplus);
150150
assert(stacktop >= 0);
151151
dest->stackpointer = dest->localsplus + stacktop;
152+
// visited is GC bookkeeping for the current stack walk, not frame state.
153+
dest->visited = 0;
154+
#ifdef Py_DEBUG
155+
dest->lltrace = src->lltrace;
156+
#endif
152157
for (int i = 0; i < stacktop; i++) {
153158
dest->localsplus[i] = PyStackRef_MakeHeapSafe(src->localsplus[i]);
154159
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Initialize ``_PyInterpreterFrame.visited`` when copying interpreter frames so
2+
incremental GC does not read an uninitialized byte from generator and
3+
frame-object copies.

0 commit comments

Comments
 (0)