Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix up testcapi.frame_getvar
  • Loading branch information
markshannon committed Jul 17, 2024
commit 26a4fd718f7792787e56f4748c5b91d0213a9736
8 changes: 3 additions & 5 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,8 +1882,9 @@ frame_get_var(_PyInterpreterFrame *frame, PyCodeObject *co, int i,
return 0;
}

PyObject *value = PyStackRef_AsPyObjectBorrow(frame->localsplus[i]);
if (frame->stackpointer > frame->localsplus) {
PyObject *value = NULL;
if (frame->stackpointer == NULL || frame->stackpointer > frame->localsplus + i) {
value = PyStackRef_AsPyObjectBorrow(frame->localsplus[i]);
if (kind & CO_FAST_FREE) {
// The cell was set by COPY_FREE_VARS.
assert(value != NULL && PyCell_Check(value));
Expand All @@ -1901,9 +1902,6 @@ frame_get_var(_PyInterpreterFrame *frame, PyCodeObject *co, int i,
}
}
}
else {
assert(value == NULL);
}
*pvalue = value;
return 1;
}
Expand Down