Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,9 @@ _PyFrame_GetLocals(_PyInterpreterFrame *frame)
}

PyFrameObject* f = _PyFrame_GetFrameObject(frame);
if (f == NULL) {
return NULL;
}

return _PyFrameLocalsProxy_New(f);
}
Expand Down
22 changes: 15 additions & 7 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2293,14 +2293,17 @@ _PyEval_ExceptionGroupMatch(_PyInterpreterFrame *frame, PyObject* exc_value,
return -1;
}
PyFrameObject *f = _PyFrame_GetFrameObject(frame);
if (f != NULL) {
PyObject *tb = _PyTraceBack_FromFrame(NULL, f);
if (tb == NULL) {
return -1;
}
PyException_SetTraceback(wrapped, tb);
Py_DECREF(tb);
if (f == NULL) {
Py_DECREF(wrapped);
return -1;
}

PyObject *tb = _PyTraceBack_FromFrame(NULL, f);
if (tb == NULL) {
return -1;
}
PyException_SetTraceback(wrapped, tb);
Py_DECREF(tb);
*match = wrapped;
}
*rest = Py_NewRef(Py_None);
Expand Down Expand Up @@ -2778,6 +2781,11 @@ PyEval_GetLocals(void)

if (PyFrameLocalsProxy_Check(locals)) {
PyFrameObject *f = _PyFrame_GetFrameObject(current_frame);
if (f == NULL) {
Py_DECREF(locals);
return NULL;
}

PyObject *ret = f->f_locals_cache;
if (ret == NULL) {
ret = PyDict_New();
Expand Down
Loading